Can't spawn objects on the game

0 favourites
From the Asset Store
Welcome! I-Spy (Hidden objects) is an educational puzzle that is more than just seek-and-find activities.
  • Hi guys!

    I'm working on a side scroller, a flappy bird like game. I'm currently trying to add some powerups to randomly spawn in between the pillars of the game, like on the screenshot below:

    To do this, I'm trying this events:

    But it's not working. The powerups don't spawn in the game. Anything you might think I'm getting wrong?

  • You set the powerup_spawn to random(1,10) and check the condition equal 1/2/3. It is impossible to make it equal 1/2/3. Because of the powerup_spawn will be 1.5,2.2,4.6,.etc. You should use choose(0,1,2,3).

  • Also, you should put an Else

    And a Trigger once on each condition other ways you will spawn like 60 to 80 powerUps as you change the powerUp value every 1.2 sec

  • Maverick1912 Oh, I didn't know the random expression could return a decimal! That was so helpful. I'm just starting on this whole programming thing, even though we don't actually program on Construct. Thanks for the fast answer man! :)

  • tarek2 Yeah, just found that out after changing the random to choose, hahahaha. I haven't used else or triggers yet, but I'm gonna take a look on those. Thanks man!

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • If you want to use random in future with whole numbers you can use 'round' to round up or 'floor' to round down. i.e. round(random(1,10)) or floor(random(1,10))

  • tarek2 Yeah, just found that out after changing the random to choose, hahahaha. I haven't used else or triggers yet, but I'm gonna take a look on those. Thanks man!

    No problem mate

    Another problem you may run into its Referencing to Pillarup if its more than one object and you don't PrePick The Pillar, this I'm not sure if you Pick or you just have one Pillar in the whole level as I cannot see the rest of the events but it is something to look into it.

    I hope it helps good luck mate

  • Nice! I was actually thinking about this, 'cause I want to add some multipliers to the score. Like doing some things in the match triggers, let's say, a 1.25x multiplier. This will definitely be useful. Can I use "round" or "floor" on other statements, or only on "random"?

    tarek2 Yeah, I ran into this problem also. It's set to choose a number every 1.2 seconds because that's the spawn time of the pillars. Would you mind explaining a little bit about this PrePick? Or just point me to some guide/tutorial? :)

  • On any number. I had it wrong though, floor is to round down, ceil to round up and round picks the nearest if that is useful. So you can say round(1.2) and that returns 1. round(1.6) and that returns 2.

  • Nice! Even more useful! I will definitely use this. Thanks again! I'm just thrilled with all this comments xD you guys are the best

  • tarek2 Yeah, I ran into this problem also. It's set to choose a number every 1.2 seconds because that's the spawn time of the pillars. Would you mind explaining a little bit about this PrePick? Or just point me to some guide/tutorial? :)

    Sure, basically if you have more than one instance of an object, in this case Pillarup, and you need to refer to a specific Pillarup then you need to Pick first which one it is on the condition other ways will count as an "unreferenced" object and if this happens c2/c3 it will automatically apply all those Actions to (Pillarup Instance = 0) which is the first instance created of those Pillarup as it doesn't know to which instance you are referring to so it will pick automatically for you (instance= 0)

    I hope I explained properly and it's not confusing

  • Here I found the best Tutorial for you

    https://www.scirra.com/manual/75/how-events-work

    Especially look at "Unreferenced objects"

  • I hope I explained properly and it's not confusing

    Absolutely, dude!!

    Here I found the best Tutorial for you

    I'll check it out. Thanks!!

  • I really like that art work you are using in the game. Look really good.

  • BlueBidis Thanks dude! I really enjoy pixel art :) I'm glad you liked it!

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