I am trying to make grid-movement sidescroller. Player and enemies all use grid mevement behavior but with diferent settings... Beside of that Player can change direction of gravity, so same input can have diferent actions (vertical or horizontal, +1 grid size or -1 grid size), and some enemies can walk on wals. I can make each of this movements separatly, but I wonder if I can make something like one Global Movement Entity function, so that this function can be called from each object who have grid movement with different settings that are then sent to this function.
If I include all moving entites in to family MovEnt, can I then do something like this:
for enemies something like -
Bad.X < Player.X --- set Bad.Value('Step') to 1
--- Call function "MoveHor"
Player -
Left Arrow is down --- set Player.Value('Step') to -1
--- Call function "MoveHor"
...and so on...
On fuction "MoveHor" --- MovEnt: Move MoveEnt.Value('Step') horizontaly
I cant access MoveEnt private variables in "move X steps horizontaly" field of MoveEnt grid movement behavior... Is there some other way to do something like this? (sorry for bad english)