How to move actor like in GRID

JaxterJaxter Member, PRO Posts: 398
edited November -1 in Working with GS (Mac)
I need with two buttons move actor ( with animation between start and end position) to left and right for example 100pix, like in chess game, how can i do it ?

here is example: http://idea-lab.lv/citi/example.jpg

Comments

  • VmlwebVmlweb Member Posts: 427
    This can be achieved with a maths function
    I think you need to constrain X, Y of the object to this

    floor (( self.Position.X/Y + 50 ) / 100 ) * 100
  • PhoticsPhotics Member Posts: 4,172
    I did something similar with the Photics: Toolbox.
    http://photics.com/toolbox

    The tally counter uses interpolate for movement.
  • beefy_clyrobeefy_clyro Member Posts: 5,394
    constraining can be rough on your fps, i'd try and use interpolate as Photics has said
  • JaxterJaxter Member, PRO Posts: 398
    hm i just need move box +100 - 100 on stage left and right
  • VmlwebVmlweb Member Posts: 427
    You could do that with rules

    If position.x between 0 and 150
    change positino.x to 100

    If position.x between 150 and 250
    change positino.x to 200

    If position.x between 250 and 350
    change positino.x to 300
  • JaxterJaxter Member, PRO Posts: 398
    i think it is not my solution, are any template anywhere
  • JaxterJaxter Member, PRO Posts: 398
    I need to move it when each time i touch button it just moving to side for 100pix , and the same back to left side
  • BarkBarkCoBarkBarkCo Member Posts: 1,400
    Not saying it's a better method, but my snake demo uses SPAWN to "move" the actor around. Instead of moving, you just spawn a new version of the actor 100px away from the original actor and then destroy the original.

    I can't get to the game link right now, but do a search for "move by spawn" in the shared projects section in GS.
  • JaxterJaxter Member, PRO Posts: 398
    Really helpfull , tnx, but i have problem.. how can i make borders to not let to cross those. I will work only when use move atribute.. but i am using SPAWN

    www.idea-lab.lv/citi/borders.png ( just spawn in 3 positions and stay on bouth corners
Sign In or Register to comment.