Movement To Path By Pixels (aka am I dumb?)

0 favourites
  • 9 posts
From the Asset Store
Vintage steam pixels for your UI! 125 unique assets in a single pack!
  • So far - I haven't had any of my questions answered so I'm starting to wonder if I'm asking dumb questions...

    Anyway here is another one...

    I've been searching the forums a lot - and I see a lot of grid based movement and board movement etc - but I think I'm trying to do something really simple and I'm just dumb...

    So here is what I'm trying to do:

    Have a map - I set the sprite to the target - i move the sprite x amount of pixel each turn to the position - there is no objects or anything that will block it's path.

    And here is what I came up with:

    VAR speed = 32 (pixels)

    SPRITE.X = 10

    SPRITE.Y = 10

    VAR x 300

    VAR y 300

    VAR distanceToMove = 0

    Every Tick

    distance != speed

    Round(Sprite.X) != Round(x)

    Round(Sprite.y) != Round(y)

    ---------Action = Sprite set angle toward (x,y)

                      Sprite move forward 1 pixels

                      Sprite Add 1 to distToMove

    This makes it move as I wanted - but this sits in the main event and I wanted it as a function which I could pass in X,Y Speed etc - but I couldn't get it to move to the location pixel by pixel turn by turn...

    How dumb am I?


  • Um... Please help?

  • Your best bet is to post a capx file. Pseudo code isn't your friend here.

  • Ah!

    Okay let's see if this work!

  • test_fnc

    This does what you have but with two functions. Doesn't need to be two, just showing variations of calling functions.

  • Thanks

    The link appears to be broken though :(

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • Appears you're using 120 i'm using the purchased Steam Version - Thanks for your time I'll see if I can install 2 versions to check it out!


  • Got it open!

    Thank you so much for taking the time to do this - I'm not understanding how it is working - I'll keep playing with it until i understand what it's doing. Thanks again for the help!

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