The Daily Click ::. Forums ::. Klik Coding Help ::. Random placing of objects
 

Post Reply  Post Oekaki 
 

Posted By Message

lembi2001



Registered
  01/04/2005
Points
  608

VIP MemberIt's-a me, Mario!Wii OwnerI like Aliens!Has Donated, Thank You!PS3 OwnerI am an April Fool
24th May, 2006 at 19:10:10 -

I am having a little problem with my current game "The Box" ( http://www2.create-games.com/preview.asp?id=2562 ) - shameless plug .

I am trying to place the boxes at random with the values inside placed at random. I am however having a little problem doing this. I own both MMF and TGF so i will be able to do it in either if someone tells me how i do it. Please help!?!?!?!?!?!?!?!

 
n/a

Matt Boothman

The Nissan Micra of forum members

Registered
  20/09/2002
Points
  109

Game of the Week Winner
24th May, 2006 at 19:15:03 -

+ Create Object (outside of play area)
+ Set X Pos to (Random (Frame Width))
+ Set Y Pos to (Random (Frame Height))

You might want to create a buffer zone as well, which is discussed in this article: http://www2.create-games.com/article.asp?id=1633

 
http://soundcloud.com/normbo - Listen to my music.

lembi2001



Registered
  01/04/2005
Points
  608

VIP MemberIt's-a me, Mario!Wii OwnerI like Aliens!Has Donated, Thank You!PS3 OwnerI am an April Fool
24th May, 2006 at 19:35:05 -

cheers for the quick response but i want all the objects to be placed in certain positions but randomly. For instance the game is using 22 boxes split up into 2 groups of eleven on each side of the screen.

I will try to demonstrate.

_1_2_3_4_5_ _6_7_8_9_10_


I need to randomly place the boxes like this:

_3_2_6_7_10_ _1_4_5_9_8_

after they have been placed i need to randomly assign a value to them. the values can be 1 through to 22 i can edit this later in tgf or mmf whichever is easiest

 
n/a

axel

Crazy?

Registered
  05/02/2005
Points
  4766

Game of the Week WinnerYou've Been Circy'd!
24th May, 2006 at 20:04:56 -

I bet you could do it with 'pick an object at random' and some flags and stuff. I might make an example when I get home.

 
n/a

Matt Boothman

The Nissan Micra of forum members

Registered
  20/09/2002
Points
  109

Game of the Week Winner
24th May, 2006 at 20:51:25 -

Is it Deal or No Deal?

 
http://soundcloud.com/normbo - Listen to my music.

lembi2001



Registered
  01/04/2005
Points
  608

VIP MemberIt's-a me, Mario!Wii OwnerI like Aliens!Has Donated, Thank You!PS3 OwnerI am an April Fool
24th May, 2006 at 23:03:08 -

Yes it is based on deal or no deal

check the link. it has some screenies and an intro but only the mpg version works.

http://www2.create-games.com/preview.asp?id=2562

 
n/a

Radix

hot for teacher

Registered
  01/10/2003
Points
  3139

Has Donated, Thank You!VIP MemberGOTW WINNER CUP 1!GOTW WINNER CUP 2!GOTW WINNER CUP 3!GOTW WINNER CUP 4!
24th May, 2006 at 23:18:07 -

Rather than using 22 different active objects, I'd just use 22 copies of one and then allocate some unique identifying values randomly.

 
n/a

lembi2001



Registered
  01/04/2005
Points
  608

VIP MemberIt's-a me, Mario!Wii OwnerI like Aliens!Has Donated, Thank You!PS3 OwnerI am an April Fool
24th May, 2006 at 23:32:14 -

Ive tried that but when i click on one of the boxes all of the buggers open.

 
n/a

Radix

hot for teacher

Registered
  01/10/2003
Points
  3139

Has Donated, Thank You!VIP MemberGOTW WINNER CUP 1!GOTW WINNER CUP 2!GOTW WINNER CUP 3!GOTW WINNER CUP 4!
25th May, 2006 at 09:34:09 -

That just means you need to figure out MMF's object focus.

Like, if
User clicks on Box
---{Open Box]

doesn't work properly (I don't know whether it would or not, I'm just trying to guess what you tried), try:

Always
---Active1: set position to [mouse coords]
---Active1: make invisible

User clicks on Box
+Active1 is overlapping Box
---{Open Box]


Just to trick MMF into picking the right one. There are other ways, of course. I'd probably use something elegant with grid coordinates.

 
n/a
   

Post Reply



 



Advertisement

Worth A Click