Skip to content

Instantly share code, notes, and snippets.

@codetravis
Created February 7, 2017 13:32
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 codetravis/4717a0f58eed12d55ccba224664ed4aa to your computer and use it in GitHub Desktop.
Save codetravis/4717a0f58eed12d55ccba224664ed4aa to your computer and use it in GitHub Desktop.
14.1 Add friction to the player movement and modify player speed
Method CreatePlayer()
Local box:ftObject = engine.CreateAnimImage(game_sprite_atlas.GetImage("player_submarine_anim"), 0, 0,
128, game_sprite_atlas.GetImageHeight("player_submarine_anim"), 3, engine.GetCanvasWidth()/2, engine.GetCanvasHeight()/2)
' Change the player max speed and add friction
box.SetMaxSpeed(10.0)
box.SetMinSpeed(-10.0)
box.SetFriction(0.5)
box.SetColGroup(PLAYER_GROUP)
box.SetColType(Self.engine.ctBox)
box.SetText("PLAYER")
Local projectile_type:ProjectileType = New ProjectileType()
Self.player = New Character(box, projectile_type, 0, 3, "PLAYER")
End
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment