avatar for bookwormrwt

bookwormrwt

Latest Activity: Played Bloons Tower Defense 4 (Apr 23, 2019 1:14pm)

Points needed for next level: 42
Level 27
Location the internet
Member Since Feb. 03, 2008

/////////ActionScript for Snake////////////

var unit = 15;
var uwh = 20;
var canMove = false;
var dir = 2;
var score = 0;
aPieceList = new Array();
mouseListener = new Object();
mouseListener.onMouseDown = function()
{
if (!canMove)
{
canMove = true;
startGame();
}
};
Mouse.addListener(mouseListener);
k = new Object();
k.onKeyDown = function()
{
var k = Key.getCode();
if (k == Key.UP && dir != 2 && canMove)
{
dir = 0;
canMove = false;
}
else if (k == Key.LEFT && dir != 3 && canMove)
{
dir = 1;
canMove = false;
}
else if (k == Key.DOWN && dir != 0 && canMove)
{
dir = 2;
canMove = false;
}
else if (k == Key.RIGHT && dir != 1 && canMove)
{
dir = 3;
canMove = false;
}
};
Key.addListener(k);
function addPiece()
{
var p = this.attachMovie(โ€œpieceโ€, โ€œpieceโ€ + aPieceList.length, aPieceList.length);
p.x = aPieceList[aPieceList.length โ€“ 1].x;
p.y = aPieceList[aPieceList.length โ€“ 1].y;
aPieceList.push(p);
}
function moveFood()
{
var moveIt = true;
while (moveIt)
{
food.x = Math.floor(Math.random() * uwh) * unit;
food.y = Math.floor(Math.random() * uwh) * unit;
moveIt = false;
for (var i = 0; i < aPieceList.length; i++)
{
if (aPieceList[i].x == food.x && aPieceList[i].y == food.y)
{
moveIt = true;
}
}
}
}
function gameOver()
{
delete this.onEnterFrame;
tScore.text = "You Lose. Score: " + score;
canMove = false;
}
function startGame()
{
for (var i = aPieceList.length โ€“ 1; i >= 0; iโ€”)
{
aPieceList[i].removeMovieClip();
aPieceList.pop();
}
score = 0;
var p = this.attachMovie(โ€œpieceโ€, โ€œpieceโ€ + aPieceList.length, aPieceList.length);
aPieceList.push(p);
p.x = 10 * unit;
p.y = 10 * unit;
var food = this.attachMovie(โ€œfoodโ€, โ€œfoodโ€, 1);
var c = 0;
moveFood();
var startingLength = 3;
for (var i = 1; i < startingLength; i++)
{
addPiece();
}
this.onEnterFrame = function()
{
canMove = true;
tScore.text = score;
for (var i = aPieceList.length โ€“ 1; i > 0; i
-)
{
aPieceList[i].x = aPieceList[i โ€“ 1].x;
aPieceList[i].y = aPieceList[i โ€“ 1].y;
}
if (dir == 0)
{
aPieceList0.y -= unit;
}
else if (dir == 1)
{
aPieceList0.x -= unit;
}
else if (dir == 2)
{
aPieceList0.
y += unit;
}
else if (dir == 3)
{
aPieceList0.
x += unit;
}
if (aPieceList0.
y / unit == 20)
{
aPieceList0.
y = 0;
}
else if (aPieceList0.
y / unit == -1)
{
aPieceList0.
y = 19 * unit;
}
else if (aPieceList0.
x / unit == -1)
{
aPieceList0.
x = 19 * unit;
}
else if (aPieceList0.
x / unit == 20)
{
aPieceList0.
x = 0;
}
if (aPieceList0.
x == food.
x && aPieceList0.
y == food.
y)
{
score = 10 * aPieceList.length / 2;
moveFood();
addPiece();
}
for (var i = 1; i < aPieceList.length; i
+)
{
if (aPieceList0.
x == aPieceList[i].
x && aPieceList0.
y == aPieceList[i].
y)
{
gameOver();
}
}
};
}

///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////

I now make fps games. If you would like to download my first one, go t my site http://sites.google.com/site/bookwormrwt/home

Games by bookwormrwt (22)

Play Shipwreck
  • A small, text oriented RPG. The first installment in my Choose Your Own Adven...
    Play The Adventures of Corny
  • You are Corny. You have been inexplicably thrust into a world full of coins. ...
    Play City Attack
  • The year is 2020 and Australia has run out of beer. They have sent an aerial ...
    Play Snake 2
  • The sequel to snake 1. duh.
    Play The Constellation Game
  • My first educational game. I actually turned this in as a science project for...
    Play Learn How to Make a Game Like Snake
  • My first tutorial. I hope this jumpstarts a whole bunch of new developers.
    Play Alien Chasers
  • You are a flying alien, trapped in space. Ships filled with bad people are tr...
    Play Hangman
  • Just a hangman game...
    Play The Anti-Hobo Game
  • I have nothing against hobos, but I was bored.
    Play Interplanetary Smackdown
  • A fighting game that I really enjoyed making.
    Play Robot
  • A platformer
    Play Checkers
  • You guys know what Checkers is right?!
    Play Breakout
  • A simple breakout game, based on the classic.
    Play Frogger
  • A classic frogger game with hand drawn graphics.
    Play Snake
  • Snake
    classic snake game
    Play Dance, Dance
  • Make Bob dance to 3 different songs!
    Play Mr. Potato Head the flash version
  • When you can't find the solid one, use the digital one. Make him look stupid...
    Play RED
  • RED
    This is a simple game that I threw together at a sleepover. THIS IS AN EXTREM...

    Activity Feed

      bookwormrwt has not published any activity yet.Would you like to post a shout to welcome them to Kongregate?

    Loading...
    avatar for Adirondack
    Adirondack
    Level 26 โ€ข 40 friends
    avatar for Wavelcuas
    Wavelcuas
    Level 6 โ€ข 2 friends
    avatar for richard11166
    richard11166
    Level 5 โ€ข 47 friends
    avatar for Duffalpha
    Duffalpha
    Level 12 โ€ข 4 friends
    Loading...
    Play Pandemic 2
    Pandemic 2
    VIRUS STRATEGY MOUSE ONLY
    8,314,943 plays
    Play American 9-Ball Pool
    American 9-Ball Pool
    POOL SPORTS 2 PLAYER
    242,779 plays
    Play Versus
    Versus
    STRATEGY PUZZLE
    5,504 plays
    Play Toss the Turtle
    Toss the Turtle
    LAUNCH TURTLE FLIGHT
    10,206,622 plays
    Play Frontier
    Frontier
    ADVENTURE BUSINESS MANAGEMENT
    2,783,614 plays
    Play Alice is Dead - Ep 1
    Alice is Dead - Ep 1
    POINT AND CLICK ADVENTURE MYSTERY
    896,270 plays