Hallo,
da ich mal was mit .lua machen wollte, hab ich mir mal versucht was zusammenzuschreiben, das die Position Y an meinem UFO (das ich als Testobjekt benutze) um 1 nach oben verschieben soll, wenn man das Input Binding "UP" drückt.
Nur funktioniert das nicht. Kann mir da jemand helfen?
[lua]
ufo = {};
function UFO.prerequisitesPresent(specializations)
return SpecializationUtil.hasSpecialization(Motorized, specializations);
end;
function UFO:load(xmlFile)
end;
function UFO:mouseEvent(posX, posY, isDown, isUp, button)
end;
function UFO:keyEvent(unicode, sym, modifier, isDown)
end;
function UFO:update(dt)
if self:getIsActiveForInput() and InputBinding.isPressed(InputBinding.UFO_UP) then
local x,y,z = getWorldTranslation(self);
posY = local y;
posY + 1;
setTranslation(self, local x, posY, local z);
end;
end;
function UFO:draw()
g_currentMission:addHelpButtonText(g_i18n:getText("UFO_UP"), InputBinding.UFO_UP);
end;[/lua]