The Daily Click ::. Forums ::. Klik Coding Help ::. Need a little help.
 

Post Reply  Post Oekaki 
 

Posted By Message

Toxic



Registered
  02/11/2004
Points
  61
4th November, 2004 at 13:17:17 -

I need some help with a game I'm working on...

Ok, say I wanted to make an object that dies when it collides with a certain other object twice, but I wanted to make hundreds of these, so making counters for each is out of the question. How should I go about doing this? And another thing. If I want certain enemies to be friendly to certain players, but attack others, how would I go about doing that?

Any solutions would be much appreciated.

 
Look me in my brand new eyes.

David Newton (DavidN)

Invisible

Registered
  27/10/2002
Points
  8322

Honored Admin Alumnus
4th November, 2004 at 14:04:12 -

Each object has a number of internal alterable values, which can be used as counters that are "tied" to the object. In the case you mention, the events would go something like this (using the terms Object and, arbitrarily, Fred):

Object collides with Fred + Object's alterable value A >= 1 : Destroy Object
Object collides with Fred + Object's alterable value A = 0 : Add 1 to Alterable Value A of Object

There's a good reason that they're placed in that order - if they were not, then the object would have 1 added, then it would be immediately destroyed.

As for your second problem, each individual player's movable object will be different, so I don't think it will be too much of a problem.

 
http://www.davidn.co.nr - Games, music, living in America

Toxic



Registered
  02/11/2004
Points
  61
4th November, 2004 at 17:03:56 -

If anyone is still reading this, I need help with one other thing.

Many objects in my game are set to bouncing ball movement, and somehow they go straight through objects they are supposed to bounce off of.

 
Look me in my brand new eyes.

Noyb



Registered
  31/05/2004
Points
  1117

VIP Member
4th November, 2004 at 17:20:00 -

You'll need a separate event for colliding with obstacles and for each active object (or one group which includes all active objects that cause the object to bounce).
Your code should be:
Object collides with obstacle (make the background objects obstacles in their properties): Object- bounce.
Object collides with active object (represents any active object you want it to bounce off of, repeat for each or put in a group): object- bounce.
Bouncing ball objects are notoriously buggy with bouncing off moving objects, however.

 
"Omg. Where did they get the idea to not use army guys? Are they taking drugs?" --Tim Schafer on originality in videogames

Toxic



Registered
  02/11/2004
Points
  61
4th November, 2004 at 17:40:03 -

Sorry, I should've made my question more specific. I have aready set events to make the object bounce, but it still doesn't.

 
Look me in my brand new eyes.

醤油の兵士

Almost Human

Registered
  12/06/2002
Points
  173

VIP Member
5th November, 2004 at 00:39:55 -

have you made sure your backdrops are set as obstacles as mentioned earlier.

 
As a boy, I wanted to be a train. I didn’t realize this was unusual—that other kids played with trains, not as them.

Toxic



Registered
  02/11/2004
Points
  61
5th November, 2004 at 11:38:51 -

Yes, but sometimes objects still wiggle through somehow.

 
Look me in my brand new eyes.

DaVince

This fool just HAD to have a custom rating

Registered
  04/09/2004
Points
  7998

Game of the Week WinnerClickzine StaffHas Donated, Thank You!Cardboard BoxDos Rules!
5th November, 2004 at 11:41:34 -

Probably because more than 300 objects are showing. Read the board about object limits.

 
Old member (~2004-2007).

Toxic



Registered
  02/11/2004
Points
  61
5th November, 2004 at 11:48:44 -

Not that either, there's way less than 300 objects and it still glitches.

 
Look me in my brand new eyes.

ChrisB

Crazy?

Registered
  16/08/2002
Points
  5457
5th November, 2004 at 13:06:41 -

If you always set their direction to one that makes them go through the obstacle, they'll go through it anyway. Slowly rotating the object using Direction Calculator will stop that happening.

 
n/a

Toxic



Registered
  02/11/2004
Points
  61
5th November, 2004 at 16:39:08 -

Alright, I fixed the collision problem, but I need help with one other thing.

Say a player starts with 500 points, which can be spent buying new units that appear in the game. Say one unit costs 25, one 50, and one 200. My problem is that the player can still buy the unit that costs 200 even if he only has 25. How do I solve this?

 
Look me in my brand new eyes.

Noyb



Registered
  31/05/2004
Points
  1117

VIP Member
5th November, 2004 at 23:33:58 -

Add the condition: counter(or score or whatever you're using to store points) >= 200 to the purchasing event.

 
"Omg. Where did they get the idea to not use army guys? Are they taking drugs?" --Tim Schafer on originality in videogames

Toxic



Registered
  02/11/2004
Points
  61
6th November, 2004 at 02:22:21 -

Thanks everyone for helping me solve all these problems.

 
Look me in my brand new eyes.
   

Post Reply



 



Advertisement

Worth A Click