Skip to content

Instantly share code, notes, and snippets.

@codetravis
Last active February 3, 2017 15:13
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/41c2fd790d571c14ba3c69e6b618ad83 to your computer and use it in GitHub Desktop.
Save codetravis/41c2fd790d571c14ba3c69e6b618ad83 to your computer and use it in GitHub Desktop.
13.1 Loading player sprite sheet and attaching it to the player
Class Game Extends App
'......................
Field current_level:Int
' add fields to hold new player image
Field player_image:Image
Const FINAL_LEVEL:Int = 2
'.................
End
'......................
Method CreatePlayer()
' load player sprite
player_image = Image.Load("player_submarine_anim.png")
Local box:ftObject = engine.CreateAnimImage(player_image, 0, 0, 128, 64, 3, engine.GetCanvasWidth()/2, engine.GetCanvasHeight()/2)
box.SetMaxSpeed(20.0)
box.SetMinSpeed(-20.0)
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