Created
December 17, 2016 08:58
-
-
Save Rukia3d/caa5b5c7bef609a3ef013bc752f83228 to your computer and use it in GitHub Desktop.
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
--Start run listener initiated | |
--setting up environment and level | |
setHero(act.character) | |
setUpAnimations(hero) | |
hero.run() | |
hero.runningSprite.collision = onCharCollision | |
--setup Hero’s animations | |
timer.performWithDelay(100, function() | |
local vx, vy = hero.runningSprite:getLinearVelocity() | |
if vy<-100 and hero.runningSprite.sequence ~= “jumpUp” then | |
print(“Has to go up”) | |
hero.jumpUp() | |
end | |
if vy >=100 and hero.runningSprite.sequence== “jumpUp” then | |
print(“Has to land”) | |
hero.jumpDown() | |
end | |
end, 0) | |
--on Character collision | |
--.. collision with some dangerous object | |
--.. collision with some collectable object | |
--collision on top of the platform | |
if GAMESTATE == “Run” and hero.runningSprite.sequence==”jumpDown” then | |
heroState =”Run” | |
timer.performWithDelay(1, hero.landPhysics ) | |
timer.performWithDelay(FRAMETIME*4, hero.run ) | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment