Hi all,
Ok this OO stuff is real new to me (and many others I`m sure) and although I think I`m getting it I still have one small question. I want to add the following function to the players type as I have done with the UpdatePlayers() and DrawPlayers() functions (which are now methods) but I am a little unsure how to add it. Any help would be great.
Jason.
Function CreatePlayer(x,y,sp,si)
Local p:players
p=New players
p.x=x
p.y=y
p.sp=sp
p.si=si
ListAddLast plist,p
pcount=pcount+1
End Function
Type players
Field x
Field y
Field sp
Field si
Method UpdatePlayers()
If KeyDown(KEY_LEFT) Then x=x-sp
If KeyDown(KEY_RIGHT) Then x=x+sp
End Method
Method DrawPlayers()
SetColor 255,100,0
DrawRect x,y,si,si
SetColor 255,255,255
End Method
End Type
|