May i have your attention please?

Get help using Construct 2

Post » Sun Mar 23, 2014 10:38 am

So now that i have your attention my problem is that:

i am making a cannon shoot game and i have a cannon that shoots bullets towards the mouse. i fill the distance
between the cannon and the mouse with 10 dots that pointing the target.
Now i want that dots to disappear when they are overlapping a wall and to reappear when they are not.
Something like that lets say the dots is counting 1 from the beginning(cannon) to 10 mouse(target) .when lets say the fifth dot overlaps a wall i want to disappear the fifth dot and all other dots that reach the target(6,7,8,9
and 10) and when there is no overlapping i want to reappear.

something like that.

all dots

----------

overlaps wall

----|

after overlap

----------

keep in mind that i don't want to create a new dot every tick something like this if dots<10 then create dot.
I am pretty sure its tricky.
Any help or suggestion please?
thanks!
B
36
S
15
G
1
Posts: 59
Reputation: 3,441

Post » Sun Mar 23, 2014 12:07 pm

hmmm....

If you want "Dots" to always be there (you create them in the editor and never destroy them in Runtime)... you can make instance variable in them (let's call it DotID) and number them from down to top.

if the third Dot (DotID=3) overlaps a "wall" then change Visibility or Opacity of all Dots with (DotID >= 3) to make them invisible. if no "Dot" overlaps "Wall" make all Dots Visible.

I hope this helps
B
10
S
1
G
1
Posts: 22
Reputation: 848

Post » Sun Mar 23, 2014 1:21 pm

https://dl.dropboxusercontent.com/u/108 ... iming.capx - Try playing with this, it works on low angles like 10 degrees, but as it's half past midnight, I'm too tired to work out the rest of the code, but you can have a play with it and try to get it working :)
Using R243 for all examples
B
69
S
20
G
6
Posts: 379
Reputation: 9,699

Post » Sun Mar 23, 2014 3:30 pm

ahmadmanga wrote:hmmm....

If you want "Dots" to always be there (you create them in the editor and never destroy them in Runtime)... you can make instance variable in them (let's call it DotID) and number them from down to top.

if the third Dot (DotID=3) overlaps a "wall" then change Visibility or Opacity of all Dots with (DotID >= 3) to make them invisible. if no "Dot" overlaps "Wall" make all Dots Visible.

I hope this helps


i don't understand the trick with variables.
B
36
S
15
G
1
Posts: 59
Reputation: 3,441

Post » Sun Mar 23, 2014 4:31 pm

Never mind i solved it
in case anyone interest is similar the way ahmadmanga mention
i make 10 dots to fill the distance between the cannon and the mouse with a loop ,
then i make a global var with the number of the dots in my case 10 so globdots =10
when dot overlaps wall globdots=dot.iid else globdots =10
then system pick by comparison dots globdots <=dot.iid set opacity to 0 else set opacity to 100 .
B
36
S
15
G
1
Posts: 59
Reputation: 3,441


Return to How do I....?

Who is online

Users browsing this forum: No registered users and 16 guests