The Daily Click ::. Forums ::. Klik Coding Help ::. Random Generatoin for MMF2 games
 

Post Reply  Post Oekaki 
 

Posted By Message

Jon C-B

I create vaporware

Registered
  23/04/2008
Points
  237

I'm an alien!VIP MemberWii OwnerI donated an open source project Santa Hat
17th February, 2009 at 00:44:57 -

How do you make things randomly generate, like platforms, blocks, stuff like that. I think it would be cool to make a squeal to my Mini Compo game Dots http://www.create-games.com/download.asp?id=7581 . Could anyone give me some tips?

 
n/a

Silveraura

God's God

Registered
  08/08/2002
Points
  6747

Game of the Week WinnerKlikCast StarAlien In Training!VIP Member360 OwnerWii OwnerSonic SpeedThe Cake is a LieComputerChristmas Tree!
I am an April Fool
17th February, 2009 at 01:21:46 -

Random ( Number )
This can be used in limitless ways.

For example:
Create Object at any position.
Set X Position of object to Random(640)
Set Y Position of object to Random(480)

You now have an object being created in a random location inside of a frame that's 640x480 big. If your frame is bigger or smaller, adjust accordingly. If you want to make it so that it randomly spawns around an object, well then you need to be a little more creative like adding to the random number.

Edited by Silveraura

 
http://www.facebook.com/truediamondgame

OMC

What a goofball

Registered
  21/05/2007
Points
  3516

KlikCast Musician! Guy with a HatSomewhat CrazyARGH SignLikes TDCHas Donated, Thank You!Retired Admin
17th February, 2009 at 01:48:46 -

Also, don't forget:

Object is overlapping object + pick one of object > set X and Y to aforementioned random values.

 

  		
  		

Jon C-B

I create vaporware

Registered
  23/04/2008
Points
  237

I'm an alien!VIP MemberWii OwnerI donated an open source project Santa Hat
19th February, 2009 at 00:33:08 -

The randomization works fine, but they still sometimes get created outside the frame. Could it be because i'm using a fast loop to create generate my platforms?

 
n/a

Eternal Man [EE]

Pitied the FOO

Registered
  18/01/2007
Points
  2955

Game of the Week WinnerHero of TimeLOL SignI am an April Fool
19th February, 2009 at 02:03:08 -

No FOO! It all depends on your Random(number), see BrandonC's reply yet again.

 
Eternal Entertainment's Code'n'Art Man

E_E = All Indie


...actually Ell Endie, but whatever.
Image
Image
   

Post Reply



 



Advertisement

Worth A Click