So another evening spent on this at last. But another evening where I feel I'm hitting my head against a brick wall.
Right now, I'm pointing scripts to the player entity with Script.PlayerTarget = nil --entity and dragging the Player to the related box in the editor. But when I switch between projects, etc., this has often seems to be wiped out. So I need to keep setting it. It's frustrating, so I figure I should just tell the script directly that I want it to work with the player entity.
for x=0,App.world:CountEntities()-1 do
local entity = App.world:GetEntity(x)
entInfo = entity:GetKeyValue("name")
System:Print(entInfo)
end
As I think I've said before, the above works to output entity names to the Output window. This gave me the idea to use GetEntity() to specify the name directly with: self.PlayerTarget = App.world:GetEntity(Player)
But this just throws back an error. I can find no documentation on GetEntity.
Is there a simple way to state directly in a script that variable X should equal entity y, without using a loop like the above to search for it? [self.PlayerTarget = entity:GetKeyValue("Player") didn't seem to work either]
On an unrelated note, I've noticed that the way in which I was outputting coordinates to the screen no longer works unless I'm in debug mode.
function Script:PostRender(context)
local font = Font:Load("Fonts/arial.ttf", 12)
App.context:SetFont(font)
App.context:SetBlendMode(Blend.Alpha)
if self.Text ~="" then
context:DrawText("Current output is " .. self.Text, 102, 22)
end
App.context:SetBlendMode(Blend.Solid)
end
This used to output text when "Running" the game but now only does so when "Debugging". Did something change?
EDIT: Actually come to think of it, I don't recall seeing the FPS counter that usually displays either. Is there a hotkey toggle for that which I may have accidentally pressed?