Move the Box move style!

Ok I have been going nuts trying to figure this out.

I need to be able to move the Actor Left, Right, Up or down depending on which way I press him and move him.
Here is the catchy part though. I only want him to move 30 pixels or so in any direction that I move him too.

This is not a swipe, Think of it like constraining is self.position.x to mouse.touch.x or whatever But only allowing him to go a max of 30 pxl in any direction.

One more question,
How do I get him to fall freely if another actor is not underneath him holding him up?

Comments

  • Braydon_SFXBraydon_SFX Member, Sous Chef, Bowlboy Sidekick Posts: 9,273
    You could probably figure this out with snap to grid tutorials.
  • Braydon_SFXBraydon_SFX Member, Sous Chef, Bowlboy Sidekick Posts: 9,273
    Here's an example -- "stole" some things from other tutorials, but whipped this up for you.
  • Ok thanks, Last question. I want red actor to sit ontop of blue actor so blue is acting as an actor and a solid object. If I move red actor right with snap to grid and there is nothing below him he falls to the ground. What direction do I go with that? You dont have to in depth explain, Just point me in the direction :)
  • Braydon_SFXBraydon_SFX Member, Sous Chef, Bowlboy Sidekick Posts: 9,273
    You may be able to create a table that has as many cells are there are tiles on your grid. You can make them booleans. When the solid actor is beneath the red actor, change the cell value of the red actor (-1 row, which would represent one tile below the red actor). You could then calculate the values of the table to determine if a spot has the blue actor is beneath the red actor. Very vague, but hopefully that gives you an idea... There's probably an easier way to do it, but thats the direction I would be going...
Sign In or Register to comment.