Simple grid based pathfinding.

Discussion and feedback on Construct 2

Post » Sun Mar 19, 2017 7:20 am

TRMG wrote:
AndreasR wrote:You can do this with @rexrainbow "GridMove" behavior. The code for this is very simple.

Just add the "Board" & "SquareTX" plugin to your project.
Add a new sprite "tile" and give it the behavior "Chess".
Add the "GridMove" behavior to your player.

On start -> Fill board with "tile" //tile is a sprite object for your ground.

On touched object "tile" -> Player move to "tile.Chess.LX, tile.Chess.LY"

All plugins and behaviors can be found here.
http://c2rexplugins.weebly.com/

Regards
Andy

Hey Andy, I have done what you said (without the fill board thing), but it doesn't work...
Here's the .capx: https://www.dropbox.com/s/upab2qxj9njp3 ... .capx?dl=0


The board is the important part ;)
I updated your capx example, please find it here.
https://www.dropbox.com/s/wbm43691jwsaa ... .capx?dl=1

Regards
Andy
Image Image iTunes: Match3 | Google Play: Match3
B
109
S
40
G
31
Posts: 1,177
Reputation: 29,418

Post » Mon Mar 20, 2017 7:14 pm

AndreasR wrote:
TRMG wrote:
AndreasR wrote:You can do this with @rexrainbow "GridMove" behavior. The code for this is very simple.

Just add the "Board" & "SquareTX" plugin to your project.
Add a new sprite "tile" and give it the behavior "Chess".
Add the "GridMove" behavior to your player.

On start -> Fill board with "tile" //tile is a sprite object for your ground.

On touched object "tile" -> Player move to "tile.Chess.LX, tile.Chess.LY"

All plugins and behaviors can be found here.
http://c2rexplugins.weebly.com/

Regards
Andy

Hey Andy, I have done what you said (without the fill board thing), but it doesn't work...
Here's the .capx: https://www.dropbox.com/s/upab2qxj9njp3 ... .capx?dl=0


The board is the important part ;)
I updated your capx example, please find it here.
https://www.dropbox.com/s/wbm43691jwsaa ... .capx?dl=1

Regards
Andy

I see =D
Thank you
ImageImageImageImage
B
30
S
9
G
7
Posts: 262
Reputation: 5,646

Post » Mon Mar 20, 2017 9:34 pm

@rexrainbow
I never got the board plugins working. Always crashing on me. Even that example trows me this error ....

Uncaught TypeError: this.GetBoard(...).xy2NeighborDir is not a function
at behaviorProto.Instance.behinstProto.target2dir (Rex_GridMove_behavior.js:211)
at behaviorProto.Instance.Acts.MoveToLXY (Rex_GridMove_behavior.js:701)
at Action.run_object (eveng.js:1848)
at EventBlock.run_actions_and_subevents (eveng.js:931)
at EventBlock.run (eveng.js:888)
at Runtime.executeSingleTrigger (preview.js:4949)
at Runtime.triggerOnSheetForTypeName (preview.js:4868)
at Runtime.triggerOnSheet (preview.js:4800)
at Runtime.trigger (preview.js:4777)
at pluginProto.Instance.instanceProto.onMouseDown (Mouse_plugin.js:127)
at HTMLDocument.<anonymous> (Mouse_plugin.js:66)
at HTMLDocument.dispatch (jquery-2.1.1.min.js:3)
at HTMLDocument.r.handle (jquery-2.1.1.min.js:3)
B
33
S
18
G
28
Posts: 2,493
Reputation: 20,950

Post » Mon Mar 20, 2017 11:52 pm

@99Instances2Go

Try update plugins to the last version.
B
110
S
28
G
280
Posts: 4,488
Reputation: 156,568

Previous

Return to Construct 2 General

Who is online

Users browsing this forum: No registered users and 12 guests