Timers and Rand Function ??

Non-platform specific questions.

Timers and Rand Function ??

Postby Just4Fun » Sat Feb 21, 2004 8:19 am

Is it possible to have an actor appear and disappear at different random screen locations for a time period of 10 seconds? If so, how is it done ?

I've checked the forum, the demos and the tutorials without success. TIA :?
I've learned that I still have a lot to learn.

** Makslane == Genious **
Just4Fun
 
Posts: 524
Joined: Tue Jul 01, 2003 5:19 am
Location: USA: Washington State; West Coast
Score: 6 Give a positive score

One test

Postby ingsan » Sat Feb 21, 2004 9:30 am

i'm not a boss at programming but try this little little code of mine.

Add actor "MainActor"

Add Event Create Actor
Add Action Create Timer // and create ur timer.

Now :
Add Event Timer
Add Action Script Editor and write :

Code: Select all
x=rand(+-xscreen);
y=rand(+-yscreen);


It's done.

MainActor should change position and get a random one after timer. As u see no need for me to destror actor.U can eventually Destroyactor and after Destroy, Create it elswhere using the code that i've gave u.

...please, don't laugh at my poor code :oops:
I hope i helped u. :wink:
User avatar
ingsan
 
Posts: 580
Joined: Mon Nov 17, 2003 4:02 pm
Location: Maurician LADY in FRANCE
Score: 6 Give a positive score

Postby Just4Fun » Sat Feb 21, 2004 7:04 pm

ingsan:

Thank You! That was EXACTLY what I needed. I'm still pretty confused about the timer and how to use it. I've been studying jazz-e-bob's "shark" timers, but they aren't quite what I was after and they are sophisticated enough that most of them confused me more than I already was. I appreciate your extra effort in taking the time to reply.It's hard learning how GE works, but it is also great fun to make a break through in figuring out a solution to a problem. Thanks Again. :lol:
I've learned that I still have a lot to learn.

** Makslane == Genious **
Just4Fun
 
Posts: 524
Joined: Tue Jul 01, 2003 5:19 am
Location: USA: Washington State; West Coast
Score: 6 Give a positive score

Postby ingsan » Sat Feb 21, 2004 9:06 pm

Don't thank me it's normal :wink:

For the timer, just ask urself :

Well, i have created a Timer (Timer A). What can happen when i call that timer of mine ?

Which means : On EVENT Timer, what can i make ? and u can justHaveFun after that ! :lol:
User avatar
ingsan
 
Posts: 580
Joined: Mon Nov 17, 2003 4:02 pm
Location: Maurician LADY in FRANCE
Score: 6 Give a positive score

Postby Just4Fun » Sun Feb 22, 2004 2:49 am

My image is moving to random screen locations...but the locations are only in the upper right of the screen. I've tried modifying the math in the above script but that hasn't accomplished full screen movement. I need random appearance all over the screen. I think this has to do with the xscreen / yscreen co-ordinates or maybe x,y. :?

Any more ideas?.....TIA
I've learned that I still have a lot to learn.

** Makslane == Genious **
Just4Fun
 
Posts: 524
Joined: Tue Jul 01, 2003 5:19 am
Location: USA: Washington State; West Coast
Score: 6 Give a positive score

Postby makslane » Sun Feb 22, 2004 9:11 pm

x = rand(view.width) + view.x;
y = rand(view.height) + view.y;
makslane
Site Admin
 
Posts: 3947
Joined: Sat Apr 05, 2003 6:47 pm
Score: 182 Give a positive score

Postby Just4Fun » Sun Feb 22, 2004 10:19 pm

Perfect! Thank You. :lol:

* Now, onto the next problem...
I've learned that I still have a lot to learn.

** Makslane == Genious **
Just4Fun
 
Posts: 524
Joined: Tue Jul 01, 2003 5:19 am
Location: USA: Washington State; West Coast
Score: 6 Give a positive score

Re: Timers and Rand Function ??

Postby Zivouhr » Thu May 07, 2015 1:56 pm

Helpful information, thanks. Noticed the thread is 12 years old, but it's still useful! :)
City of Rott Game created on Game Editor http://cityofrott.wordpress.com/
User avatar
Zivouhr
 
Posts: 549
Joined: Sat May 17, 2014 2:12 pm
Score: 59 Give a positive score


Return to General

Who is online

Users browsing this forum: No registered users and 1 guest

cron