Skip to content

Instantly share code, notes, and snippets.

@codetravis
Last active December 22, 2016 13:16
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/258687ff1866e61c0493ec1e901f5a13 to your computer and use it in GitHub Desktop.
Save codetravis/258687ff1866e61c0493ec1e901f5a13 to your computer and use it in GitHub Desktop.
8.16 Add point value and points earned to Character class
Import fantomX
Import projectile_type
Class Character
Field box:ftObject
Field current_health:Int
Field max_health:Int
Field is_player:Bool
Field projectile_type:ProjectileType
Field last_projectile_time:Float
' Give characters a point value and points earned field
Field point_value:Int
Field points_earned:Int
' Add the point value in the constructor
Method New(box:ftObject, projectile_type:ProjectileType, point_value:Int=5, health:Int=1, player:Bool=False)
Self.box = box
Self.current_health = health
Self.max_health = health
Self.is_player = player
Self.projectile_type = projectile_type
Self.last_projectile_time = Millisecs()
' initialize the point value and points earned fields
Self.point_value = point_value
Self.points_earned = 0
End
'....................
' Simple method for increasing the score
Method IncreaseScore(points:Int=0)
Self.points_earned += points
End
End
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment