How do I add ennemy sprites in my level?

Get help using Construct 2

Post » Sun Feb 21, 2016 2:20 pm

Hello to all

In my game i need now to add ennemies.
My Layout game is 15000 width, 1080height (window is 1920x1080)
how to add (spawn) ennemies at random positions with a random time and outside the screen (entering when player move)?
Image
B
37
S
15
G
7
Posts: 1,679
Reputation: 9,610

Post » Sun Feb 21, 2016 3:08 pm

Random time is relatively easy. Just use the every x seconds and use random(#,#) in your spawner.

You can either use x value; player.x > 1200 activate spawner 1 or you can use an industry standard... triggers; invisible sprites along the path and turn on off screen spawners (both ahead and behind player) when player overlaps them.


As for spawning mobs off screen simple make their x value greater or less than screen width on creation.
Check out my completed games on the Arcade! Capt. Doe Save the Universe! & Clicker Wizard!
B
66
S
17
G
8
Posts: 637
Reputation: 9,370

Post » Sun Feb 21, 2016 3:54 pm

Do you have any clear capx? :D
B
37
S
15
G
7
Posts: 1,679
Reputation: 9,610

Post » Sun Feb 21, 2016 4:18 pm

i have the pink spawners objects on the left and right side, who are allways at the same position no parallax for that layer.
http://s21.postimg.org/epmgd8j9h/ennemy_spawn.jpg

i tried this event but sprites are not spawned from the point "0" of the pink spawners
Image

when im moving on the level who scroll the sprites are not created at the right places ( spawners left & right)

whats wrong on my code events?
B
37
S
15
G
7
Posts: 1,679
Reputation: 9,610

Post » Sun Feb 21, 2016 5:23 pm

Classic off-by-one. If you have ImagePoints 0,1,2, ImagePointCount will be 3. Subtract one from ImagePointCount to get the last ImagePoint.
ImageImageImage
B
71
S
21
G
230
Posts: 3,688
Reputation: 128,847

Post » Sun Feb 21, 2016 5:41 pm

what???
what i have to clearly add in the events??
B
37
S
15
G
7
Posts: 1,679
Reputation: 9,610

Post » Sun Feb 21, 2016 7:54 pm

what code event i have to add?
B
37
S
15
G
7
Posts: 1,679
Reputation: 9,610

Post » Mon Feb 22, 2016 9:20 am

here is how i did it:

Every 3 seconds > Create Object (Enemy) on layer 1 at (Layout width + Total Distance + 40 + Random(70) , 0)

in my situation Total Distance is a global number. but u can just make it "Layout Width + something"

Let me know if it helped. I got a question too, if u can help me let me know
B
4
Posts: 10
Reputation: 224

Post » Mon Feb 22, 2016 10:41 am

Hello, what kind of help :D you need
B
37
S
15
G
7
Posts: 1,679
Reputation: 9,610

Post » Mon Feb 22, 2016 7:20 pm

im stuck.. .. whats the "exact" formula to add. :s
this is my actual code event.
Image
B
37
S
15
G
7
Posts: 1,679
Reputation: 9,610

Next

Return to How do I....?

Who is online

Users browsing this forum: Rhindon, YoHoho and 23 guests