Many sprites move as one

Get help using Construct 2

Post » Tue Apr 02, 2013 3:28 am

I've got a row of 10 sprites, and I want them all to spawn at the top of the screen, wait a few seconds, move down into the next row, wait, go active, die, respawn back at square one and just keep repeating this sequence. Problem is I don't know how to make them all move without having 30 different sprites.
B
6
Posts: 90
Reputation: 690

Post » Tue Apr 02, 2013 5:40 am

Have you tried having an invisible sprite placed in the direction that you want your 10 sprites to move, and then using a move-toward action/event?
B
6
S
1
Posts: 31
Reputation: 703

Post » Wed Apr 03, 2013 2:47 am

[QUOTE=DoobieDoctor5000] Have you tried having an invisible sprite placed in the direction that you want your 10 sprites to move, and then using a move-toward action/event?[/QUOTE] I have not, but I want to have them all spawn back at the top once they're dead. I could do that to have them move down, but is there something that will do both move them down and get them to spawn back when they're destroyed?
B
6
Posts: 90
Reputation: 690

Post » Wed Apr 03, 2013 11:45 am

Maybe you could try using families/Containers for such a movement....
alternatively you could be able to use the pin behaviour to pin your sprites to an invisible Controller sprite and move just the Controller downwards...when it reaches the bottom and gets "destroyed" you just Trigger your Actions (i.e. add a value to the score) and set the Controller sprites Location to the top again to "respawn"
B
4
S
1
Posts: 5
Reputation: 485

Post » Fri Apr 05, 2013 9:17 pm

[QUOTE=JohnnyF] Maybe you could try using families/Containers for such a movement....
alternatively you could be able to use the pin behaviour to pin your sprites to an invisible Controller sprite and move just the Controller downwards...when it reaches the bottom and gets "destroyed" you just Trigger your Actions (i.e. add a value to the score) and set the Controller sprites Location to the top again to "respawn"[/QUOTE]

Wouldn't this require you adjust each and every sprite to be a set distance away from the sprite, unless you have 30 sprites, each assigned to a enemy? I only have the free version.
B
6
Posts: 90
Reputation: 690

Post » Fri Apr 05, 2013 9:21 pm

Are you thinking Galaxians style do attack get back to formation?Pixel perfick2013-04-05 21:21:36
As long as I can move left, right and fire, I'm Happy...
B
42
S
15
G
11
Posts: 655
Reputation: 12,260

Post » Sun Apr 07, 2013 8:50 am

[QUOTE=WAFFLE OF WAR] I've got a row of 10 sprites, and I want them all to spawn at the top of the screen, wait a few seconds, move down into the next row, wait, go active, die, respawn back at square one and just keep repeating this sequence. Problem is I don't know how to make them all move without having 30 different sprites. [/QUOTE]

Can't you set the enemies to a family then set them to bullet, then set there angle of motion to 270. You can then have an expression like:

Event---> System: enemiesfamily.Y > What Ever Vertical Distance You Choose
Action---> enemiesfamily destroy

Event--->enemiesfamly on destroyed
Action---> create object enemies at position (n,n)
      --->set angle of motion to 270
repeat-->10 times

n=the position you want them to respawn at
B
18
S
4
G
3
Posts: 436
Reputation: 4,801

Post » Thu Apr 11, 2013 2:56 am

[QUOTE=retrodude] [QUOTE=WAFFLE OF WAR] I've got a row of 10 sprites, and I want them all to spawn at the top of the screen, wait a few seconds, move down into the next row, wait, go active, die, respawn back at square one and just keep repeating this sequence. Problem is I don't know how to make them all move without having 30 different sprites. [/QUOTE]

Can't you set the enemies to a family then set them to bullet, then set there angle of motion to 270. You can then have an expression like:

Event---> System: enemiesfamily.Y > What Ever Vertical Distance You Choose
Action---> enemiesfamily destroy

Event--->enemiesfamly on destroyed
Action---> create object enemies at position (n,n)
      --->set angle of motion to 270
repeat-->10 times

n=the position you want them to respawn at[/QUOTE] Families require the full version of C2, so they aren't an option for me.
B
6
Posts: 90
Reputation: 690

Post » Thu Apr 11, 2013 5:32 am

Use 1 base sprite, copy and paste. If you want different images, use either different frames or instance variables and different animations.

Set Sprite.Y to Sprite.Y + distance per second * dt

where dt is DeltaTime.TL222013-04-11 05:34:36
B
56
S
20
G
7
Posts: 305
Reputation: 8,754


Return to How do I....?

Who is online

Users browsing this forum: Draconinho, peturfoto and 14 guests