Page 1 of 1

Problems with Instances

PostPosted: Sun Aug 21, 2016 3:01 am
by AwesomePuppy
So, I'm trying to make a ship based game, and I have hit a roadblock. Every time I destroy an enemy ship, the ship and its turrets blow up. But the thing is, when a single ship gets destroyed, all turrets on the map get destroyed. Also, how do i add in a reload system for the player's ship's guns. Any suggestions?

You can play here: http://localhost:50000/
Download: https://www.dropbox.com/home?preview=Ship+Battles.capx

Re: Problems with Instances

PostPosted: Sun Aug 21, 2016 3:58 am
by oosyrag
You need conditions to pick the turrets that blow up. In your conditions, you probably already reference the ship, so the game knows which ship to destroy. If you add an action to destroy turret without picking any, it is assumed that that action will be applied to all turrets.

Try adding the condition turret is overlapping ship.

Utilizing containers is a good way to work around this as well.

There are many many ways to implement reloading, so without any further detail on the specific behavior you want I'm going to just suggest you run a quick search. Generally it involves a counter variable to keep track of ammo remaining and some events to handle what happens in different "states" (ammo full, partially empty, empty).

Re: Problems with Instances

PostPosted: Sun Aug 21, 2016 2:24 pm
by Lordshiva1948
AwesomePuppy if you want to learn about INSTANCE VARIABLE take look at this tutorial link below


https://www.scirra.com/tutorials/806/instance-variable