Creating multiple copies of the enemy

For questions about using Classic.

Post » Wed Jul 29, 2009 3:14 pm

Hello.

I've faced with such problem: there is an enemy in the game, composed of many sprites (gun and other accessories). The enemy comes from certain point on the map, for example, every 3 seconds. At the beginning all enemies go as expected, but when the number of enemies increases, their weapons begins to copy. Imagine that - the enemy has 1 gun, when number of enemies become more and every enemy already has 2 guns, then 3 guns, etc....



Example .cap file with enemies - [url:3g1olaei]http://www.fileqube.com/shared/GzciJxcYp1503977[/url:3g1olaei]

Question:

1. How to create many copies of the enemy, that each of them would have only 1 gun (or something else)?

2. How to create the same copies of one sprite at the same time from different locations on the map? (because I have only one point which creates enemies)
B
3
S
2
G
3
Posts: 146
Reputation: 1,567

Post » Wed Jul 29, 2009 3:57 pm



If you click your Sprite "Sprite" then Group>Container then Add Object and add the Gun (called R in your cap) all should be fine.

Edit cap is below.

http://rapidshare.com/files/261425618/enemy.cap
B
46
S
23
G
7
Posts: 459
Reputation: 6,763

Post » Wed Jul 29, 2009 4:17 pm

Minor

It works! Thanks! :D
B
3
S
2
G
3
Posts: 146
Reputation: 1,567

Post » Wed Jul 29, 2009 4:36 pm

Here's a .cap with random spawn points.

http://rapidshare.com/files/261437053/enemy2.cap

Basically creates a random number every 3000 m/s. It checks for each random number and spawns an enemy at a different position for 0,1,2.

Took me a while to sort out as I'm still new to construct ways, but it was good practice.
B
46
S
23
G
7
Posts: 459
Reputation: 6,763

Post » Wed Jul 29, 2009 4:42 pm

Minor,

Thank you again! You helped me very much! :P
B
3
S
2
G
3
Posts: 146
Reputation: 1,567

Post » Wed Jul 29, 2009 5:46 pm

It would be easier to do enemy spawning using "Pick a random object" under CREATE_01's conditions. That will pick a random instance of CREATE_01. Then you just create the enemy at the location of the spawn point, like this: Enemy spawning
Moderator
B
97
S
36
G
19
Posts: 1,584
Reputation: 17,692

Post » Wed Jul 29, 2009 6:41 pm

linkman2004,
Your variant is very good too! Thanks for help!
B
3
S
2
G
3
Posts: 146
Reputation: 1,567

Post » Wed Jul 29, 2009 9:13 pm

[quote="linkman2004":3tq61rii]It would be easier to do enemy spawning using "Pick a random object" under CREATE_01's conditions. That will pick a random instance of CREATE_01. Then you just create the enemy at the location of the spawn point, like this: Enemy spawning[/quote:3tq61rii]

Ah much simpler than my solution. Thanks. Still I played around and learned new bits and bobs.
B
46
S
23
G
7
Posts: 459
Reputation: 6,763


Return to Help & Support using Construct Classic

Who is online

Users browsing this forum: Yahoo [Bot] and 1 guest