Created
February 7, 2017 13:32
-
-
Save codetravis/4717a0f58eed12d55ccba224664ed4aa to your computer and use it in GitHub Desktop.
14.1 Add friction to the player movement and modify player speed
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
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