Skip to content

Instantly share code, notes, and snippets.

@Rukia3d
Created December 17, 2016 08:58
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save Rukia3d/caa5b5c7bef609a3ef013bc752f83228 to your computer and use it in GitHub Desktop.
Save Rukia3d/caa5b5c7bef609a3ef013bc752f83228 to your computer and use it in GitHub Desktop.
--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