Create a gist now

Instantly share code, notes, and snippets.

What would you like to do?
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