i need help moving

how do you make so if you tap to the right of an actor it moves right? do you put 2 blocks and put if touch is inside the right one move right?

Comments

  • jamie_cjamie_c ImagineLabs.rocks Member, PRO Posts: 5,772
    One way to do it would be to put a large button over the entire stage and keep track of your players X and Y locations. Then when the player touches the screen you could compare the players X/Y location with the X/Y of the touch location and move the player in the correct direction.

    I'm just typing that off the top of my head, without testing it, but it should work.
  • GM_PandagamesGM_Pandagames Member Posts: 228
    umm i dont get it. :(
  • bjandthekatzbjandthekatz Orlando, FlMember Posts: 1,375
    when mouse positon x is greater than 160 and pressed change game.right to true
    when mouse position x is less than 160 and pressed change game.left to true

    This should work
  • -Timo--Timo- Member Posts: 2,313
    I don't get what you want exactly. do you have 2 actors in the screen and then when you press the right one only the right one moves? and when you press the left one the left one moves right?

    or do you have 1 actor and when you touch outside of the actor on the right side it moves to the right?

    can you try to explain better ? ;)
  • gyroscopegyroscope I am here.Member, Sous Chef, PRO Posts: 6,598

    Hi @GM_Pandagames Similar to what the other guys said, but with a bit more detail (although still a rough idea):

    Make a real attribute, called PosX.

    Bring an actor onto your screen, make it the size of the screen, call it Back.
    Put the actor you want to move onto the screen. Change the value of PosX to its X position. In the Rules of the moving actor, put:

    Constrain Attribute self.Position.X to PosX

    Now in the Rules of the Back actor, put:

    Rule: When touch is pressed
    Rule: ---nested in above--When game.Touches.Touch 1.X > scene.PosX
    ---your moving rules to the right for your moving actor, depending on the method of moving chosen
    Otherwise
    ---your moving rules to the left for your moving actor, depending on the method of moving chosen

    THat should give you a good start.
  • jamie_cjamie_c ImagineLabs.rocks Member, PRO Posts: 5,772
    Here is a sample I worked up, it's rough but it should get the point across.

    I changed it up from my description above so there are no constraints.
  • DuesDues Member Posts: 1,159
    Thought you wanted help carrying some furniture or something... ;)
  • GM_PandagamesGM_Pandagames Member Posts: 228
    everybody thx. how would i make it move on a grid? i already have a block moving on a grid with the keyboard.
Sign In or Register to comment.