Handling multiple objects of the same type

Get help using Construct 2

Post » Mon Sep 24, 2012 11:22 pm

Hi guys!

I'm enjoying my construct a lot and have found lots of help in this forum from reading other posts. However, I haven't found a great answer for my problem.

My current project is a sort of tower/base-defense. I have several enemies, towers and items. I'm trying to figure out the best way to control all those objects. So far I've seen two suggestions:

1) Use 1 sprite for each object "type" (e.g. one sprite for all enemies and then change animations.
2) Use families

I prefer the second solution which seems more logical to me. However, as this is my first project my "code" has been terribly made - I've created events which refers to each specific object, e.g. "basic tower attacks creep#1", instead of a more generic type, e.g. "(any) Tower attacks (any) Creep". As you can imagine I have dozens of events which would have to be duplicated if I were to continue this way.

To keep things short: how should I approach correcting all my work? It seems like an insane amount of work to replace every event into families! You can look at the following two images to get an idea of what I mean.

https://dl.dropbox.com/u/4793120/base_defense1.png
https://dl.dropbox.com/u/4793120/base_defense2.png

I hope you can help me :)

Best,
NightHaunter

Edit: Feel free to comment on any horrible event-practices I've come to adopt btw ;)NightHaunter2012-09-24 23:25:16
B
16
S
4
G
4
Posts: 13
Reputation: 4,266

Post » Tue Sep 25, 2012 12:05 am

Calm down @NightHaunter, do you have any CAPX to share?

I can write a extensive post here, but you would prefer read direct to the font:

http://www.scirra.com/tutorials/361/understanding-uid-iid-health-cards-and-rocket-smoke-trail
http://www.scirra.com/tutorials/355/making-character-composed-of-multiple-parts
ImageImageImageImageImageImage
B
93
S
20
G
12
Posts: 1,212
Reputation: 18,482

Post » Tue Sep 25, 2012 6:33 pm

Thanks for you answer, @TELLES0808

I'm using a project-file but made it into a capx which you can get here:
https://dl.dropbox.com/u/4793120/capxversion.capx.

The thing I'm most interested in is figuring out the right way to do multiple creeps, towers and items. And especially how I should approach correcting all my horrible code :)
B
16
S
4
G
4
Posts: 13
Reputation: 4,266

Post » Wed Sep 26, 2012 10:09 pm

http://www.scirra.com/tutorials/252/random-animation

I'll travel today, and the forum recently come back, so, I can't work on your request by 4 days, if nobody help you I'll come back and do the job.

See you!
ImageImageImageImageImageImage
B
93
S
20
G
12
Posts: 1,212
Reputation: 18,482

Post » Wed Sep 26, 2012 10:13 pm

Thanks, I'll look into it :)
B
16
S
4
G
4
Posts: 13
Reputation: 4,266


Return to How do I....?

Who is online

Users browsing this forum: spacedoubt, Yahoo [Bot] and 3 guests