able to convert from 'Object' to 'TPlayer'
BlitzMax Forums/BlitzMax Beginners Area/able to convert from 'Object' to 'TPlayer'
| ||
Local Player:TPlayer = PlayerList.Last() What am I doing wrong? |
| ||
You have to caste, for example: pTSentinel = TSentinel(m_pTSentinelList.Last()) Matt, do you know particles? |
| ||
I know particles, yes.. What is the casting, use TPlayer and PlayerList :) |
| ||
Local Player:TPlayer = TPlayer(PlayerList.Last()) What is a good way to go about creating a warp point (Andromeda Style 2D Top Down). |
| ||
Not sure what you mean? We can chat via IRC (if you dont have any IRC client go here: http://cgiirc.blitzed.org/ ) channel is #blitzbasic |
| ||
from what I understand, with the casting you can 'convert' a generic Object (the basic type of Bmax) in another type Local Player:TPlayer = PlayerList.Last() must be rewritten linke this Local Player:TPlayer = Tplayer(PlayerList.Last()) in other words you force bmax to convert the object returned by playerList to an object 'TPlayer'. |
| ||
The name of a new type also becomes a sort of function. If it is possible to turn an object into that type (casting), it will do so, otherwise it will return Null. |