Help with obstacle positioning in autorunner.

Get help using Construct 2

Post » Wed Feb 25, 2015 3:28 pm

I've got an autorunner game with obstacles and i'm having a little trouble with the positioning of the obstacles when they appear.

Basically, i've set up my obstacles so that they appear at random points on platforms but most of the obstacles that appear are near the very beginning of the platform and very little of them actually appear near the end to mix things up, so it doesn't feel very random (hope that makes sense).

I've provided a capx, so hopefully that will make my problem clearer. The code i'm using to sort the positioning of my obstacle is this -

Box - Set position to (Block.X + Block.Width / random (10,1) , Block.Y)

If i change the 'random (10,1)' portion to just 1, then all obstacles appear at the end of the platform and if i change to 10, then they'll end up at the beginning of the platform. So i thought using 'random (10,1)' would work but it's not as random as i hoped it would be.

It could be something really simple that i'm missing but can anyone help?

Thanks
You do not have the required permissions to view the files attached to this post.
B
5
S
2
Posts: 126
Reputation: 876

Post » Thu Feb 26, 2015 1:45 am

I`m guessing this is what you where looking for?
random position from tip to end? including middle? its just a math formula simple actually :)

Autorunner - Obstacles edited.capx
in future use instead of random(x,y,z) the action choose(x,y,z,s) its more accurate
You do not have the required permissions to view the files attached to this post.
B
75
S
22
G
68
Posts: 1,336
Reputation: 43,269

Post » Thu Feb 26, 2015 2:30 pm

@gamecorpstudio Cheers, this helps a lot :) Thank you!
B
5
S
2
Posts: 126
Reputation: 876


Return to How do I....?

Who is online

Users browsing this forum: No registered users and 7 guests