Object sometimes not spawning

0 favourites
  • 4 posts
From the Asset Store
Hand-painted tiles, objects, animated objects, and background to build a colorful Mayan civilization environment.
  • Hey guys! Another day, another doubt :)

    A few days ago a topic I posted here helped me spawn some powerups on my game. Everything worked just fine! But today I implemented another spawn and things went a little weird. I'm gonna show my event sheet and then explain my problem.

    So, as you can see, everytime the "pillar_up" is created, it chooses a number between 1 and 9 and set it on the "spawn_selector" variable. After that, depending on the number selected, something will spawn on the pillar. If it chooses 1, it'll spawn the Bigger Gaps powerup, if it chooses 2, the God Mode powerup, 3 the Slow Time powerup, and any other value (greater or equal to 4) it should spawn the coin. But... sometimes nothing spawns at all. Even though every pillar should have something spawned, sometimes the character passes through like 5 pillars with nothing spawned.

    Any thoughts? :)

    P.S: the game is a side scroller (a flappy bird like game).

  • I feel like they should be sub events of the on created event but they're not, so I'm not sure how it works at all, you change the variable when a pillar is created but what prompts the create object actions?

    Also checking against a global variable changing as you're creating objects seems risky. Better logic I think would be to have an instance variable on the pillar, on pillar created set instance variable to choose(1-9) so you know exactly what is has been assigned, then on created as sub events you check if instance var =1, 2, 3 >4 etc, you don't need trigger once or pick last created conditions.

  • Hey there , thanks for the tips man. I will try this out and post here if I'm succesfull. :)

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • Dude, that worked perfectly! Thank you very much! :)

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