create object at random position

For questions about using Classic.

Post » Fri May 14, 2010 10:41 am

Hello super awesome helpful people.

Once again, I can't figure out what I'm doing wrong here.

I'm trying to create a cloud object every 1-5 seconds, at a specific y, and a random x within the layoutwidth (which is 320)

So here's what I've got so far:

Every random(4000) + 1000 milliseconds -
create object cloud1Blurred at x - random(320) and y - layoutHeight + 50

then I've got another event that sends the cloud up 5 pixels every 20 milliseconds.

The problem is the cloud x position seems to always be 0, rather than a random number.

Here's the cap [url:2h9l0dgr]http://www.wethesqueemish.com/construct/plummet1.cap[/url:2h9l0dgr]

I'm sure I'm just doing something dumb, but I can't figure out for the life of me what it is.

Thanks heaps

Tim
B
10
S
4
G
5
Posts: 136
Reputation: 2,977

Post » Fri May 14, 2010 11:34 am

Its because in the event after your creation event, your resetting the X position of the clouds to 0 every 20ms.

It should be:
+ System: Every 20 milliseconds
-> cloud1Blurred: Set position to.X, cloud1Blurred.Y - 5
:D
B
7
S
2
G
4
Posts: 164
Reputation: 2,418

Post » Fri May 14, 2010 11:38 am

Good lord,

I knew it was something dumb I was doing, but I wasn't expecting something that stupid :oops:

Thanks heaps for your help
B
10
S
4
G
5
Posts: 136
Reputation: 2,977

Post » Fri May 14, 2010 11:45 am

No problem.

Don't feel stupid I'm ALWAYS doing stupid stuff like this :P.
B
7
S
2
G
4
Posts: 164
Reputation: 2,418


Return to Help & Support using Construct Classic

Who is online

Users browsing this forum: No registered users and 7 guests