Function doesn't recognise type
BlitzPlus Forums/BlitzPlus Beginners Area/Function doesn't recognise type| 
 | ||
| Hello, just a quick one, how do I make my Functions recognise my types?? I've got this: Type player field x,y end type Player1.player = New player Player1\X = centerx+gridsize Player1\Y = (centery+gridsize) - spriteoffset ;--some lines later If KeyDown = kleft Then playermoveleft() EndIf ;--further down Function playermoveleft() player1\x = player1\x - 1 End Function It's saying "Variable must be a type" What am I doing wrong now? :) Sorry for being such a noob, and thanks again in advance for the quick responses from you pros! | 
| 
 | ||
| you must set player1.player as global, so just put global player1.player at the top and it will work | 
| 
 | ||
| Change it to this: Fuction playermoveleft() For player1.player = Each player player1\x = player1\x - 1 Next End Function And that should do it. Of course, if you need to target a specific player, then this won't work. :( | 
| 
 | ||
| cheers guys | 
| 
 | ||
| Function PlayerMoveLeft(aPlayer.Player) aPlayer\x = aPlayer\x - 1 End FunctionThis will work with any player, just pass the current player to the function. |