[SOLVED] How to check if value of something is different on previous frame from current/next frame?

Gruk here says to store position to variable then compare it on next frame before updating

Well i know how to store position to variable
I know which condition to pick to compare two numbers
But how do i check what is the value of it on next frame before updating?

So far i have this

But to my understanding it is checking both variable and current position on current frame

So if i could get what variable had stored on previous frame
I could compare that with what is the position of my object in current frame
And that would solve my issue but how to do it?

Hello, ZeroX4!

I didn’t understand this question because it seems that you want to know the future values ​​and that would be impossible, as it will depend on where the player will still move the cursor in the next frame.

But answering here to store the previous frame:

I think the answer of the Gruk is what you want. Look:


If you put your events checking the variables of “CurrentMouseY” and “CurrentMouseX” before to update to the current value you will be using the previous values. because Gdevelop reads from top to bottom.

2 Likes

Well thx that is bringing me 1 step closer yet i still fail to use it
Anyway o didn’t expect it will be confusing to understand what i need but when i read my own question it does lead into opposite direction so sorry for that

I do not need to know the value i do not care about it
I need to know if it changed

2023-05-11_19_19_CmtPk8emCh_GDevelop

This white cursor is the selector i simply need to know if its position changed so so i can add sound to it when it snaps to another cell on its 16 pixel grid

Maybe there is easier or better way to do it (adding sound when it moves) but checking position was my 1st idea

Just to be clear it does not move with keys but it is object which position is changed to mouse cursor while mouse cursor is hidden

So, you need to know when the selector is moved… Can you show the events that are moving the selector? Maybe you can put the sound somewhere in these events?

1 Like

Like i said it is object that position is changed to mouse cursor which is snapping to grid

IDK how i can be so stupid sometimes
I sit everyday on Gdevelop discord and help ppl with much more complex stuff
Yet i fail on so obvious solutions that i need for myself

THX for pointing me into right direction
Even so i went different way than you suggested your tips helped me think different way and find solution

2 Likes

Fun fact dyslectics should quadruple check their text
image

1 Like