How to minimize events for mutiple charaters

Get help using Construct 2

Post » Wed Aug 21, 2013 7:09 pm

Ok Im not sure if the title is descriptive enough and was having trouble searching in the forum for something similar.

Basically I have a working character selection for a platformer with three characters, maybe more latter on. I wanted to minimize the number of events for using up memory or space for each charters.

So i made one general sprite and set of control events for that; plus separate sprites for each charter for simplicity.

How do i switch those characters objects in and out of the general sprite to work with the control event so i don't have to make the same event for each character?

Tried variable switching but couldn't figure that out. I can spawn another object by variables and delete the general sprite but that probably wont work with the general control event.

Would an array work? i don't know.

Thanks in advance for any insight.

B
20
S
4
G
1
Posts: 39
Reputation: 1,495

Post » Thu Aug 22, 2013 11:25 am

Add the characters into a Family called Characters. Then you can trigger events that apply to every character.
B
46
S
16
G
78
Posts: 2,170
Reputation: 46,357

Post » Thu Aug 22, 2013 11:24 pm

set the different characters as animation frames of only 1 sprite. create the events for the character sprite and choose the appropriate animation frame for the chosen character.
B
23
S
6
G
5
Posts: 132
Reputation: 4,487

Post » Sun Sep 08, 2013 2:29 am

Thanks guys.

B
20
S
4
G
1
Posts: 39
Reputation: 1,495

Post » Sun Sep 08, 2013 10:40 pm

You can also use the Function plugin for things that all of the bots will share too.

If everyone shoots bullets, you can have the bullet setup all in 1 function "shootBullet". Rather than having the action blocks for the "add bullet sprite", "add muzzle flash sprite", "reduce nearest bot ammo -1","PLay bullet shoot sound", "alert friendly player bots to gunshot location"...

You can see it adds up really quick.

I put off learning the function plugin until recently. I wish I would have read about it first, it would have saved me a lot of time debugging all my copypasta.
jojoe2013-09-08 22:41:26
B
29
S
8
G
4
Posts: 767
Reputation: 5,985

Post » Sun Sep 08, 2013 11:13 pm

also, when copying the events for one player to the next, the "replace object" options really comes in handy!
B
43
S
12
G
6
Posts: 446
Reputation: 6,802


Return to How do I....?

Who is online

Users browsing this forum: richcoz81, Yahoo [Bot] and 46 guests