Help on randomly generated Items

Get help using Construct 2

Post » Mon Feb 15, 2016 12:31 am

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.
B
4
Posts: 2
Reputation: 204

Post » Wed Feb 17, 2016 3:41 pm

Why not just set it to: round(random(100))?
https://www.ravenheart.ca/home
Company name changed to avoid Facebook-type shenanigans

"Someone once told me I bite off more than I can chew...

I told them I would rather choke on greatness than nibble on mediocrity."
B
22
S
6
G
1
Posts: 1,317
Reputation: 4,628

Post » Sat Mar 12, 2016 9:35 pm

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?
B
4
Posts: 2
Reputation: 204


Return to How do I....?

Who is online

Users browsing this forum: fisholith, RetroSpock and 12 guests