0 Favourites

Monopoly Movement with Pathfinding?

  • heya, frist of check this out:

    I just had in mind to create a simple Monopoly movement, hopefully you understand what im trying to say

    so here are my questions:

    • is it possible to set the pathfinding to only in one direction? so that the object/player only walks forward means he has to go a full round to reach a certain point?
    • next one, along this path i just mentioned earlier do im able to set something like a "checkpoint" ? since the route the player is moving on is always the same and doesnt change at all ? my intention was to create a function which just looks something like this moveto(nextcheckpoint.x, nextcheckpoint.y)

    that means he checks which one is the nearst checkpoint and moves to it, and the normal movement method should look something like this moveto(Array.At(X),Array.At(Y))

    i mean i could do it with couple if-statements but hopefully there is a easier way with the pathfinding method

  • Construct 3

    Buy Construct 3

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

    Buy Now Construct 3 users don't see these ads
  • You could do it just as you describe without the pathfinder.

    Give the player sprite two variables: currentTarget=0 and goalTarget=0

    Then give the square sprite one variable: targetId and number each instance, starting with 0, in the direction the board goes.

    So the setup would be the player is placed on square 0. Then your events would look like this to move the player 5 spaces for example.

    On start of layout

    --- player: add 5 to goalTarget

    player: currentTarget < self.goalTarget

    square: targetId = player.currentTarget+1

    --- player: set angle toward position (square.x, square.y)

    --- player: move forward 100*dt pixels

    player: is overlapping square

    player: currentTarget < self.goalTarget

    square: targetId = player.currentTarget+1

    --- player: add 1 to currentTarget

    I didn't take into account wrapping around the board or centering on the square but it's got the general idea.

  • You could do it just as you describe without the pathfinder.

    Give the player sprite two variables: currentTarget=0 and goalTarget=0

    Then give the square sprite one variable: targetId and number each instance, starting with 0, in the direction the board goes.

    So the setup would be the player is placed on square 0. Then your events would look like this to move the player 5 spaces for example.

    On start of layout

    --- player: add 5 to goalTarget

    player: currentTarget < self.goalTarget

    square: targetId = player.currentTarget+1

    --- player: set angle toward position (square.x, square.y)

    --- player: move forward 100*dt pixels

    player: is overlapping square

    player: currentTarget < self.goalTarget

    square: targetId = player.currentTarget+1

    --- player: add 1 to currentTarget

    I didn't take into account wrapping around the board or centering on the square but it's got the general idea.

    thank you for your answer! the basic idea it is working so far

    ht tp:// www114.zippyshare.com/v/i9L3657R/file.html

    but there are a couple problems,

    • in this example i could change the goaltarget to 4 instead of 5 and it would be the same result why?
    • also, my idea was to let the player walk forward until he reaches the end of one "line" and than he shouldnt just set a angle towards he is supposed to rotate by 90° and than keep on working to the goaltarget
    • another point is, the player is not walking exact, normally he should walk to the origin point of the sqaure means the center

    i hope you can help me out once more

    greets

  • If you like this demo, you might try this 3rd party behavior.

  • hey, thank you for your answer... it is working for me with your plugin, but to be honest i dont know what each of this functions do.. dont get me wrong normally i dont use plugins nothing against you, its just harder to understand for me

    maybe there is an way without them

    or would you translate thos functions into code that would be helpful too

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