Last active
February 3, 2017 15:13
-
-
Save codetravis/41c2fd790d571c14ba3c69e6b618ad83 to your computer and use it in GitHub Desktop.
13.1 Loading player sprite sheet and attaching it to the player
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
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