Problem with creating object on another object

0 favourites
  • 8 posts
From the Asset Store
Fully commented source code/event sheet & sprites to create a space shooter game
  • Hey!

    I am making a shooter that invovles a little ship shooting aliens. I am right now working on upgrades for the ship and one of the upgrades that i want to include is a little automatic turret that helps the ship shoot aliens. I have ran into a slight problem tho.

    I created a text that is going to work as a button to buy the turret and made the ship into a container for the turret. All of that works fine, but when i click the button it just spawns a second ship and a third if i click again and so on. They do have the turrets on their backs, but i dont want multiple ships flying around.

    <img src="http://s928.photobucket.com/user/marcusengman/media/Problem_zps2a83f3d9.jpglfilters%5buser%5d=137928730&filters%5brecent%5d=1&sort=1&o=0" border="0" />

    These are the events that i am using for the it all to work.

  • Pic didnt work. Here is a link dl.dropboxusercontent.com/u/168588892/Problem.JPG

  • I have also tried having the "Player" create the object, but i got the same result.

  • Try Construct 3

    Develop games in your browser. Powerful, performant & highly capable.

    Try Now Construct 3 users don't see these ads
  • I can't find a problem with the code. Are there even any events that spawn player? Maybe they are interfering somehow.

  • When player and turret are in a container, creating one will automatically create the other.

    Wouldn't it be much easier for the ship to spawn the turret when needed and pin the turrent to the ship on created?

  • Oh I didn't know about the container function. Interesting, new thing learned.

  • Oh i had no idea about that. Yes that would be a thousand times easier, thanks for the help!

  • If you do want to use the container, to make it easier to destroy all objects in the container in one event, you'd have to make all events regarding the turret in a group and have the turret be invisible at start. Then when the turret is set visible activate the group.

Jump to:
Active Users
There are 1 visitors browsing this topic (0 users and 1 guests)