SOLVED

Get help using Construct 2

Post » Wed May 01, 2013 2:04 pm

https://www.dropbox.com/s/pue4cfgz75v4lzq/walkingtotheleftisexciting.capx
What is supposed to happen:
Each second, a slime will go into one of the directions:left, right, up,down, or it will stand still. Each of these actions have a 1/5 chance of happening. However, what happens is, all the slimes go to the left for 1 second and stop... forever. What am I doing wrong?fassFlash2013-05-04 11:20:27
HARMLESS SIGNATURE THAT IS VIEWED BY OTHERS AS OFFENSIVE AND CONTROVERSIAL
B
14
S
3
G
3
Posts: 356
Reputation: 4,362

Post » Wed May 01, 2013 2:21 pm

Random doesn't produce whole, rounded numbers.

This means that random(4) will give you anything from 0 to 3.999r, with 1.89237783 and 2.12301203 and everything else in between. You should use round(random(4)) to get a whole random number from 0-4.
B
56
S
15
G
10
Posts: 910
Reputation: 11,952

Post » Wed May 01, 2013 2:21 pm

let people see your game on the scirra arcade so they can try to help instead of going to random sights
B
39
S
10
G
7
Posts: 514
Reputation: 9,426

Post » Wed May 01, 2013 2:25 pm

Posting the .capx itself is way better, you can see the code with .capx and find out what is going on, and downloading the .capx is less time consuming for everybody including me than post it on scirra arcade. See that link?
HARMLESS SIGNATURE THAT IS VIEWED BY OTHERS AS OFFENSIVE AND CONTROVERSIAL
B
14
S
3
G
3
Posts: 356
Reputation: 4,362

Post » Wed May 01, 2013 2:26 pm

[QUOTE=GeometriX] Random doesn't produce whole, rounded numbers.

This means that random(4) will give you anything from 0 to 3.999r, with 1.89237783 and 2.12301203 and everything else in between. You should use round(random(4)) to get a whole random number from 0-4.[/QUOTE]

Thank you!
HARMLESS SIGNATURE THAT IS VIEWED BY OTHERS AS OFFENSIVE AND CONTROVERSIAL
B
14
S
3
G
3
Posts: 356
Reputation: 4,362

Post » Wed May 01, 2013 2:31 pm

@sosensible, uploading to the Arcade is a waste of time for these quick fixes. People much prefer to download the capx directly from Dropbox - it's hardly a random site :P

@fassFlash, my pleasure.GeometriX2013-05-01 14:32:02
B
56
S
15
G
10
Posts: 910
Reputation: 11,952

Post » Wed May 01, 2013 2:40 pm

yes but one person uses drop box and another person uses another site and people don't always like jumping from sight to sight
B
39
S
10
G
7
Posts: 514
Reputation: 9,426

Post » Wed May 01, 2013 3:08 pm

@geometrix
@fassflash


using round(random(4)) will give a slight bias to numbers 1,2,3

for example to return 0, it needs to be between 0 and 0.5, but to return 1 it needs to be between 0.5 and 1.5.. which is more likely

doing int(random(5)) will give the same chance for each number 0 to 4
B
28
S
8
G
1
Posts: 469
Reputation: 4,683

Post » Wed May 01, 2013 3:14 pm

@keepee, ah, cheers for that. Makes sense.

@sosensible, Dropbox is the de facto standard for sharing files around here.
B
56
S
15
G
10
Posts: 910
Reputation: 11,952

Post » Wed May 01, 2013 3:14 pm

[QUOTE=sosensible] yes but one person uses drop box and another person uses another site and people don't always like jumping from sight to sight[/QUOTE]
So, what's better, jumping from sight to sight or being unable to solve the problem?
HARMLESS SIGNATURE THAT IS VIEWED BY OTHERS AS OFFENSIVE AND CONTROVERSIAL
B
14
S
3
G
3
Posts: 356
Reputation: 4,362

Next

Return to How do I....?

Who is online

Users browsing this forum: 99Instances2Go and 21 guests