The Daily Click ::. Forums ::. Klik Coding Help ::. Problem with Create Object
 

Post Reply  Post Oekaki 
 

Posted By Message

Robbert



Registered
  19/06/2003
Points
  420
8th October, 2005 at 11:15:49 -

I am creating a soccer game which needs an "audience engine". If 2 good teams are playing there should be more visitors than when 2 bad teams are playing.

So I made this code: Number of visitors < value(visitors_wanted): Create Object "visitor".

Then: set X position at 80 (it's the position of the first seat) + Random(20)*17

20 is the total number of seats in a row for visitors in this game and 17 is the distance in pixels between two visitors. Now the problem is that there could be two or more visitors at the same spot, so it looks like only 5 visitors have shown up while I want 8! Is there any way to destroy the "doubles" and recreate the destroyed visitor for as long as an empty seat is taken? Do you guys understand me I'm not sure if I explained it well.

 
Hey mates, I'm Iglo yeah =P!

Knudde (Shab)

Administrator
Crazy?

Registered
  31/01/2003
Points
  5125

Has Donated, Thank You!Clickzine StaffKlikCast StarVIP MemberGhostbuster!Dos Rules!I donated an open source project
8th October, 2005 at 11:43:57 -

make another object, your spawning object. Then make this code.

Spawner is not overlapping audience - Create Audience Memeber
Spawner is overlapping Audience - Set X to (your formula)

 
Craps, I'm an old man!

Robbert



Registered
  19/06/2003
Points
  420
8th October, 2005 at 11:46:05 -

Maybe that is not a bad idea I will try and let you know thanks

 
Hey mates, I'm Iglo yeah =P!

Robbert



Registered
  19/06/2003
Points
  420
8th October, 2005 at 12:36:37 -

Well I tried and your explanation really seems logical but I still think that I am doing something wrong. Maybe you will explain it with the code that goes with it ? :|

 
Hey mates, I'm Iglo yeah =P!
   

Post Reply



 



Advertisement

Worth A Click