How do I move an object X number of pixels from current position?

0 favourites
  • 5 posts
From the Asset Store
Vintage steam pixels for your UI! 125 unique assets in a single pack!
  • Hi Guys!

    Hope you're well?

    I'm hoping someone can help me.

    So short story, I have a grid and within that grid I have an object.

    I also have cards that I want to control that object inside the grid (you drag a card into the drop zone and whatever is on the card determines what the object in the grid does)

    My question is, how do i have the Object move a certain amount of pixels within the grid once the player drops the card that has a move instruction on it?

    I know I can move it to a specific location, but what I want to do is move it 64 pixels on the X or Y axis from where the object is currently in the grid.

    I hope this makes sense.

    Thanks in advanced for your help

  • Hi Guys!

    Hope you're well?

    I'm hoping someone can help me.

    So short story, I have a grid and within that grid I have an object.

    I also have cards that I want to control that object inside the grid (you drag a card into the drop zone and whatever is on the card determines what the object in the grid does)

    My question is, how do i have the Object move a certain amount of pixels within the grid once the player drops the card that has a move instruction on it?

    I know I can move it to a specific location, but what I want to do is move it 64 pixels on the X or Y axis from where the object is currently in the grid.

    I hope this makes sense.

    Thanks in advanced for your help

    Hello,

    You mean that you want to see the movement? Like, every second move 10 pixels till reach the X,Y?

    Try using tween behaviour.

  • Try Construct 3

    Develop games in your browser. Powerful, performant & highly capable.

    Try Now Construct 3 users don't see these ads
  • > Hi Guys!

    > Hope you're well?

    >

    > I'm hoping someone can help me.

    >

    > So short story, I have a grid and within that grid I have an object.

    > I also have cards that I want to control that object inside the grid (you drag a card into the drop zone and whatever is on the card determines what the object in the grid does)

    >

    > My question is, how do i have the Object move a certain amount of pixels within the grid once the player drops the card that has a move instruction on it?

    >

    > I know I can move it to a specific location, but what I want to do is move it 64 pixels on the X or Y axis from where the object is currently in the grid.

    >

    > I hope this makes sense.

    >

    > Thanks in advanced for your help

    Hello,

    You mean that you want to see the movement? Like, every second move 10 pixels till reach the X,Y?

    Try using tween behaviour.

    Thanks for your reply!

    But no, like I want to move the object 64 pixels in a directing that the player chooses but the object needs to move from its current position.

    So for example if i have a 5x5 grid (each block being 64px big) and the object is on row and column 2 and the player wants to move one space down from there (so essentially after the move he would be on row 2 column 3) how would I go about doing that.

    Sorry I should have explained better.

  • If you just want to place an object 64 pixels from his current position you can always set his position using Self.X+64 or Self.Y+64

  • If you just want to place an object 64 pixels from his current position you can always set his position using Self.X+64 or Self.Y+64

    YES! thank you so much! that did it.

    Thank you so much

Jump to:
Active Users
There are 1 visitors browsing this topic (0 users and 1 guests)