1 decade ago by kidshenlong
Hey everyone!
My first post so go easy on me! I've just got hold of impact and I'm really enjoying it. I thought an appropriate project would be snake but I'm struggling to set things up elegantly.
I followed this guide and it was super helpful for setting up a basic demo
http://impactjs.com/forums/code/top-down-rpg-style-tile-based-grid-movement
I now have a sort of grid based movement which is what I was going for but it's really jolty, because of the way I've used the grid code.
Not elegant I know, but it allowed for the continued movement that I wanted from my snake clone.
I figured that progressing with this plugin isn't really going to be ideal as movement with the way I've set it up is jolty. There's probably a much easier way that I'm not seeing... Could anyway point me in the way of a more elegant solution?
I imagine I'll have to setup a grid which isn't impossible, it's just getting the snake to snap to that grid and then all of its extra pieces as well.
A version of this build is playable here (http://atomichael.com/snake/)
My first post so go easy on me! I've just got hold of impact and I'm really enjoying it. I thought an appropriate project would be snake but I'm struggling to set things up elegantly.
I followed this guide and it was super helpful for setting up a basic demo
http://impactjs.com/forums/code/top-down-rpg-style-tile-based-grid-movement
I now have a sort of grid based movement which is what I was going for but it's really jolty, because of the way I've used the grid code.
if (ig.input.state('left'))
this.moveIntention = 1;
else if (ig.input.state('right'))
this.moveIntention = 3;
else if (ig.input.state('up'))
this.moveIntention = 2;
else if (ig.input.state('down'))
this.moveIntention = 4;
if (this.moveIntention==1)
this.movement.direction = GridMovement.moveType.LEFT;
else if (this.moveIntention==3)
this.movement.direction = GridMovement.moveType.RIGHT;
else if (this.moveIntention==2)
this.movement.direction = GridMovement.moveType.UP;
else if (this.moveIntention==4)
this.movement.direction = GridMovement.moveType.DOWN;
Not elegant I know, but it allowed for the continued movement that I wanted from my snake clone.
I figured that progressing with this plugin isn't really going to be ideal as movement with the way I've set it up is jolty. There's probably a much easier way that I'm not seeing... Could anyway point me in the way of a more elegant solution?
I imagine I'll have to setup a grid which isn't impossible, it's just getting the snake to snap to that grid and then all of its extra pieces as well.
A version of this build is playable here (http://atomichael.com/snake/)
