• Hey Guest! Ever feel like entering a Game Jam, but the time limit is always too much pressure? We get it... You lead a hectic life and dedicating 3 whole days to make a game just doesn't work for you! So, why not enter the GMC SLOW JAM? Take your time! Kick back and make your game over 4 months! Interested? Then just click here!

Collision counter

berczi17

Member
Hi there!
I want to make a collision counter.
I set to the object's create event to:
global.collision = 0;

And the collision event to:
global.collision += 1;

It counts constantly when it's overlapping, but I need just one point / collision.

I have no idea, how can I do it.
 
K

kevins_office

Guest
I want to make a collision counter.
Need a lot more information about your project to be able to give suggestions.
What is the object colliding with? walls? other moving objects?
Which collision detection are you using, something like place_empty() or tile based?
 

berczi17

Member
Need a lot more information about your project to be able to give suggestions.
What is the object colliding with? walls? other moving objects?
Which collision detection are you using, something like place_empty() or tile based?
The object move automatically on a circular path and cross a line. I want to measure the object how many times cross the line.
 
K

kevins_office

Guest
The object move automatically on a circular path and cross a line. I want to measure the object how many times cross the line.
What is the line? Is it an object? Is it just a visual draw_line()?
What type of collision checking are you doing?
Is the circle always at the same xy? Couldn't you just add to the counter every time the objects xy reaches the same set position?
 

berczi17

Member
What is the line? Is it an object? Is it just a visual draw_line()?
What type of collision checking are you doing?
Is the circle always at the same xy? Couldn't you just add to the counter every time the objects xy reaches the same set position?
The line is also an object. It's a rectangle with a small thickness. I use place_meeting() collision checking.
The circle's center point is always at the same xy, but the radius is changing.
 
J

Jack Matthew

Guest
Make a variable to check if the collision has already happened, then set it to true on place meeting but only increment the collision counter if it's collision is initially false.
Then when there's no place meeting and no collision, set it back to false.
 
Top