How do I achieve space invader movement

Get help using Construct 2

Post » Thu Jul 03, 2014 1:08 am

How do I achieve the downwards movement of the space aliens in the standard spave invader game?

I can get on alien to move left and right, descending as it goes but I can't get a block of them to do this; well not without the others ultimatelt crashing into each other or loosing position.
B
4
S
1
G
2
Posts: 42
Reputation: 961

Post » Thu Jul 03, 2014 2:12 am

Well, what is your current method? Any sample capx?

Edit: attached a capx.. first idea that came to mind so be nice :)
You do not have the required permissions to view the files attached to this post.
B
24
S
9
G
4
Posts: 1,646
Reputation: 6,596

Post » Thu Jul 03, 2014 3:56 am

You basically just need to check if ANY invader has reached a certain coordinate (left or right). At that point, ALL invaders make the downwards movement and change direction.

Check the entire batch of aliens (with them all picked) to see if any has reached that point. If any were picked, you can set a variable and then in the next event, reverse the aliens if that variable is set. Alternatively, you can use a family to avoid the use of the variable, but it's a bit more complicated.
B
26
S
6
G
4
Posts: 456
Reputation: 5,853

Post » Thu Jul 03, 2014 4:15 am

Yeah that's the approach I took in the capx (well I used collision with a sprite instead of raw coordinates). He seems to have the free edition, so no families.
B
24
S
9
G
4
Posts: 1,646
Reputation: 6,596

Post » Thu Jul 03, 2014 9:24 am

Excellent, so easy when you see how :-) I was missing the "Pick All" part so was battling with multiple objects. Got the full version but don't like using the premium parts because then my students can't use them at home - but I do tell them about things like families in case they purchase.

Thanks again
B
4
S
1
G
2
Posts: 42
Reputation: 961

Post » Thu Jul 03, 2014 11:45 am

Ah yes. Families are very useful in situations where you've already picked one object and then suddenly require all of the same objects in the subevents (you can't access them because you've already picked one). For example where you need to compare a value of one object against all of the same type of object. You can do it with variables but families are nicer usually.
B
26
S
6
G
4
Posts: 456
Reputation: 5,853

Post » Sat Jul 05, 2014 3:37 am

Using the initial CAPX file as a guideline I created the following using bullet behaviour. Yip families would be much better for sure :D
You do not have the required permissions to view the files attached to this post.
B
4
S
1
G
2
Posts: 42
Reputation: 961

Post » Sat Jul 05, 2014 3:48 am

Perfect :)
B
26
S
6
G
4
Posts: 456
Reputation: 5,853


Return to How do I....?

Who is online

Users browsing this forum: No registered users and 19 guests