• 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!

How do if camera move is more than 0

Yellowhite

Member
I wanna know a specific code to my code, but for that i need know if the speed of CAMERA VIEW is moving or no.

Like
if view_is_moving
{//CODE}
else
{//STOP CODE}


or something like

if view_speed >= 1
{//CODE}
if view_speed <= 0
{// STOP CODE}


but, something functional like that, i will love a answer for.
:)
 
Couple options.
It's up to you to specify when the camera is moving, so you should really be knowing when that is happening.
In the case you went the ''follow object'' way in the room editor, then you could use that object's speed to figure out if it's making the camera move or not (in the case it's not dead center all the time).
Another option would to store the view position somewhere, and comparing the next frame to it, but I have a feeling this is not the simplest way to do it, but it's up to you, really.
Another option would be to use camera_get_view_speed_x/y
Whatever floats your boat, it's the kind of things you can do whatever way you feel, pretty much
 

Yellowhite

Member
Couple options.
It's up to you to specify when the camera is moving, so you should really be knowing when that is happening.
In the case you went the ''follow object'' way in the room editor, then you could use that object's speed to figure out if it's making the camera move or not (in the case it's not dead center all the time).
Another option would to store the view position somewhere, and comparing the next frame to it, but I have a feeling this is not the simplest way to do it, but it's up to you, really.
Another option would be to use camera_get_view_speed_x/y
Whatever floats your boat, it's the kind of things you can do whatever way you feel, pretty much
What u think the best code to do, bro?
:/
 
Well...hard to say just like that, but if you have a player dead-center all the time, I'd just use that and assume that if the player is moving, the camera is too.
But, just to be on the safe side (what would happens when you're on the borders of the map, for example?), you can use the camera_get_view_speed_x and *_y, and have a failsafe check as well.
Try some stuff. If it works and doesn't break anything else, that's just as good as 'the best'. There is basically no 'best' at-large, everything is on a case-to-case thing.
 
Top