Skip to main content

Indie game storeFree gamesFun gamesHorror games
Game developmentAssetsComics
SalesBundles
Jobs
Tags

How to test if object has been moved?

A topic by Garry Francis created Feb 12, 2020 Views: 83 Replies: 4
Viewing posts 1 to 3
Submitted

Is there a boolean function to test whether an object has been moved? Something like: 

: if (is_moved "object") {...}

By "moved", I mean it has been picked up at some point from its initial location. If not, I'll use a flag. I think I only need it for one object.

Host

I did implement this a while back but not sure I kicked the tyres.

: if (is_at_initial_location "spoon") {
   // Do something
}
Submitted (1 edit)

That may not be the right thing. If I get an object from its initial location, then drop it again in the same location, will this return true or false? It looks like it will return true (because it's at the initial location). I want it to return false (because it has been picked up or moved at least once).

Host

If you drop it in its original location, it'll return true. Which tells me I named the function correctly. I'll look at implementing a movement flag later on, but for now, I think you should somehow update your own flag (probably on_tick {} or intercept get for the object.

Submitted

Thanks. No problem.