Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Drunk_Snake Game PLEASE HELP!!
#3
What you could do is simply have a global variable to keep track of the portion of the zigzag (whether we are going in the positive or negative direction). For example, at the top of the code..
[code2=java]private int xDir = 1;[/code2]

And then, every time the snake moves, we simply change this variable, for example...
[code2=java]case Direction.NORTH:
newPoint = new Point(head.x + xDir, head.y - 1);
xDir *= -1;
break;[/code2]

This would create a wobble effect that works every turn. In order to make this for the y-axis, you would simply need a yDir global variable!
My Blog | My Setup | My Videos | Have a wonderful day.


Messages In This Thread
Drunk_Snake Game PLEASE HELP!! - by andre2pi - 12-29-2013, 04:16 AM
Re: Drunk_Snake Game PLEASE HELP!! - by andre2pi - 12-29-2013, 04:21 AM
Re: Drunk_Snake Game PLEASE HELP!! - by brandonio21_phpbb3_import2 - 01-05-2014, 11:15 PM

Possibly Related Threads…
Thread Author Replies Views Last Post
  How to export Snake Game as a Runnable JAR file? bedigursimran 0 7,197 11-19-2013, 10:01 PM
Last Post: bedigursimran
  the snake game don't like me. Aaron Rogers118 3 14,972 08-22-2013, 10:10 PM
Last Post: brandonio21

Forum Jump:


Users browsing this thread: 1 Guest(s)