Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- stop();
- var points = 0
- var speed = 10
- var gameOver = true
- dir = "Right"
- updatePlayer = function()
- {
- player._x = _xmouse
- player._y = _ymouse
- if(_xmouse > 650){
- player._x = 650
- }
- if(_xmouse < 0){
- player._x = 0
- }
- if(_ymouse > 450){
- player._y = 450
- }
- if(_ymouse < 0){
- player._y = 0
- }
- }
- checkCollisions = function()
- {
- if(shroomy.hitF(player))
- {
- cd._visible = true
- nextFrame()
- gameOver = true
- }else{
- points++
- }
- }
- updateShroomy = function()
- {
- dx = shroomy._x - _xmouse
- dy = shroomy._y - _ymouse
- theta = Math.atan2(dy,dx)
- shroomy._x -= Math.cos(theta) * speed
- shroomy._y -= Math.sin(theta) * speed
- speed += 0.05
- if((dx<10)&&(dir != "Left")){
- dir = "Left"
- shroomy._xscale *= -1
- }
- if((dx>10)&&(dir != "Right")){
- dir = "Right"
- shroomy._xscale *= -1
- }
- }
- onEnterFrame = function()
- {
- if(cd._visible == true){
- if(player.hitTest(_xmouse, _ymouse)){
- Mouse.hide();
- cd.play();
- }
- }
- if(gameOver == false){
- updatePlayer();
- updateShroomy();
- checkCollisions();
- }
- }
Add Comment
Please, Sign In to add comment