The Daily Click ::. Forums ::. Klik Coding Help ::. Create an object in a random place.
 

Post Reply  Post Oekaki 
 

Posted By Message

markrasher



Registered
  25/02/2013 18:43:57
Points
  34
27th December, 2013 at 27/12/2013 16:18:24 -

is it possible to create an object in a random place in my frame?

 
Check out my survival game project:
http://www.create-games.com/project.asp?view=main&id=2424

AndyUK

Mascot Maniac

Registered
  01/08/2002
Points
  14586

Game of the Week WinnerSecond GOTW AwardHas Donated, Thank You!VIP Member
27th December, 2013 at 27/12/2013 20:40:53 -

yes,
although you can just as easily create an object and then move it to a random place all in one go before the screen has time to update.

Lets say your frame is 640x480. Make three events with the 'create object' event first.
'Random (640)' or 'Random (480)' are manually typed into the expression editor.

event 1
-------
Create object at 0,0

event 2
-------
set object's X coordinate to random (640)

event 3
-------
set object's Y coordinate to random (480)

 
.

markrasher



Registered
  25/02/2013 18:43:57
Points
  34
28th December, 2013 at 28/12/2013 06:10:44 -

thanks ill try that

 
Check out my survival game project:
http://www.create-games.com/project.asp?view=main&id=2424
   

Post Reply



 



Advertisement

Worth A Click