Help on randomly generated Items

0 favourites
  • 3 posts
From the Asset Store
Game with complete Source-Code (Construct 3 / .c3p) + HTML5 Exported.
  • Hello everyone.

    I'm working on a 2d endless runner (think Jetpack Joyride or Wind runner)

    I'm going to make a few different types of coins for the player collect each with a unique value to the score and to the currency.

    I'm using tilemaps to do both the coins(and other collectibles) and the map. Each time the player pass a certain point in the map a new one chosen among the avalible maps to be created.

    The problem is I can't make the type of the coins that spawn on each level to be randomized. I tough that making a variable that would be randomized (using chose(1,2,3...) so that the value was always an Int would be the best way.

    I'm using a function to create each level and when i try to add the condition check to see what type of coin is going to appear they just vanish.

    Using the debug i can see that the variable is being changed but the verification and the creation of the object seems to be skiped.

    I'm using a count variable to create the tilemaps, in wich the position they have to spawn in the level count * the size of the layout

    The level count is another problems, altough for the plataforms and scenario it works it wont increase by 1 even tough the only time its suposed to increase is when the player collides with the trigger, and I disable the collision rigth after it, it increases buy 2 or 3 every step. the map stil spawns on the rigth place that is just the amount i see it increasin in the debug mode.

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • Why not just set it to: round(random(100))?

  • I still havent figured out what was happening but i keep going with the development and managed to make it work using the choose function inside the level constructor instead of the collision event.

    I wanst going to use random because I didn' t wanted to use flat numbers.

    Anyways i managed to fix all the problems I had here.

    Now I'm trying to figure out if its possible to make an object spwan from a tile inside a tile map. any ideas?

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