Skip to content

Instantly share code, notes, and snippets.

@codetravis
Created February 7, 2017 14:04
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/a75b944ae4561bd4c58bfe8e5171eb83 to your computer and use it in GitHub Desktop.
Save codetravis/a75b944ae4561bd4c58bfe8e5171eb83 to your computer and use it in GitHub Desktop.
14.2 Create a smaller player graphic and load it from the spritesheet
Method CreatePlayer()
' load the new, smaller player image from the modified sprite sheet, and add the animation frame count
Local box:ftObject = engine.CreateAnimImage(game_sprite_atlas.GetImage("player_submarine_two_animation"), 0, 0,
96, game_sprite_atlas.GetImageHeight("player_submarine_two_animation"), 4, engine.GetCanvasWidth()/2, engine.GetCanvasHeight()/2)
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