How do I spawn a turret

Just started using Construct 2? Post your questions here

Post » Thu Apr 03, 2014 3:31 pm

Hi

having problems:
every 5 seconds
I am creating an object the enemy base, this in turn spawns a turret which sits on the base

I then pin the turret to the base and give instance variables of each others UID

when each 5 seconds ticks by the Gun vanishes, or when the base is destroyed the turret jumps to another base

any help would be greatly appreciated

(also is it because i have altered scale the crude explosion sprite5 goes way off the mark?)
You do not have the required permissions to view the files attached to this post.
B
10
S
2
G
2
Posts: 45
Reputation: 2,039

Post » Thu Apr 03, 2014 7:21 pm

I think you are looking for the container.
Take sprite4 and add container. Pick NMEturret to add.
When the base (sprite4) has been destoyd, the NME will be destroyed automaticly aswell.
Further document can be found here https://www.scirra.com/manual/150/containers

Hope it helps, cheers!
It's time for me to return the favor :)
B
32
S
9
G
9
Posts: 132
Reputation: 5,370

Post » Thu Apr 03, 2014 8:18 pm

thanks that does help, the container method does seem to have stopped the enemy turrets from turning though

but not a bad fix so far thanks and fixed the basic sprites my bad set to another layer
You do not have the required permissions to view the files attached to this post.
B
10
S
2
G
2
Posts: 45
Reputation: 2,039

Post » Fri Apr 04, 2014 8:00 am

In event 3, change the Pin action mode to "Only position" instead of "Position and Angle". This fix the problem.

This might explain why your NME didn't rotate after applying the container.
3. If a condition picks one object in a container, every other associated object in its container is also picked.

You have an event (16) to set the angle of sprite4 to the player. Since NME is in the container of sprite 4 and also have the Pin action mode "Position and Angle" in event (3), NME will pick the angle of sprite4 everytick.

I find myself enjoying your game. Keep it up! I am looking forward to playing with upgrades and more :D
It's time for me to return the favor :)
B
32
S
9
G
9
Posts: 132
Reputation: 5,370

Post » Fri Apr 04, 2014 10:01 am

Great spot thank you very much!
B
10
S
2
G
2
Posts: 45
Reputation: 2,039


Return to Beginner's Questions

Who is online

Users browsing this forum: brunopalermo and 1 guest