Created
June 21, 2015 04:07
-
-
Save GSimas/941550756279f709963a to your computer and use it in GitHub Desktop.
ActionScript 2.0 Functions for Flash (CS5) Platform Game
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
stop(); | |
onEnterFrame = function(){ | |
if(Key.isDown(Key.LEFT)){ | |
personagem.direcao = "esquerda"; | |
if(personagem._x <200){ | |
colisao._x +=personagem.vel; | |
fundo._x +=personagem.vel; | |
mover._x +=personagem.vel; | |
magma._x +=personagem.vel; | |
} else { | |
personagem._x -=personagem.vel; | |
} | |
if(!personagem.pcaindo && !personagem.psubindo){ | |
personagem.gotoAndStop(personagem.direcao+"a"); | |
} | |
} | |
if(Key.isDown(Key.RIGHT)){ | |
personagem.direcao = "direita"; | |
if(personagem._x >250){ | |
colisao._x -=personagem.vel; | |
fundo._x -=personagem.vel; | |
mover._x -=personagem.vel; | |
magma._x -=personagem.vel; | |
} else { | |
personagem._x +=personagem.vel; | |
} | |
if(!personagem.pcaindo && !personagem.psubindo){ | |
personagem.gotoAndStop(personagem.direcao+"a"); | |
} | |
} | |
if(!personagem.pcaindo && !personagem.psubindo) | |
{ | |
if(Key.isDown(Key.SPACE)) | |
{ | |
personagem.pi = personagem._y; | |
personagem.gotoAndStop(personagem.direcao+"p"); | |
personagem.psubindo = true; | |
} | |
} | |
if(personagem.psubindo){ | |
if(personagem.pi <= personagem._y+100){ | |
if(personagem.pi >= personagem._y && personagem.pi <= personagem._y+70){ | |
personagem._y -=10; | |
} | |
if(personagem.pi > personagem._y+70 && personagem.pi <= personagem._y+100){ | |
personagem._y -=5; | |
} | |
} else { | |
personagem.psubindo = false; | |
personagem.pcaindo = true; | |
} | |
} | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
onClipEvent(load){ | |
var pcaindo:Boolean = false; | |
var psubindo:Boolean = false; | |
var pi:Number = 0; | |
var direcao:String = "direita"; | |
var vel:Number = 7; | |
var raio:Number = 31; | |
} | |
onClipEvent(enterFrame){ | |
if(!(_root.colisao.plataforma.hitTest(_x, _y, true))) if(!(_root.mover.plataforma.hitTest(_x, _y, true))){ | |
if(!psubindo){ | |
_y += 5; | |
pcaindo = true; | |
} | |
} | |
if(pcaindo){ | |
if(_root.colisao.plataforma.hitTest(_x, _y, true)){ | |
pcaindo = false; | |
} | |
if(_root.mover.plataforma.hitTest(_x, _y, true)){ | |
pcaindo = false; | |
} | |
} | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
stop(); | |
mover.onPress = function(){ | |
startDrag(this); | |
} | |
mover.onRelease = function(){ | |
stopDrag(); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment