Hallo, ich brauche dringend Hilfe...
Ich wollte mit der Horn Speci aus dem Beispielmod 2 verschiedene Melodien abspielen. Irgendwie hat das aber nicht funktioniert. Hab einiges versucht und das Spiel zig mal gestartet, leider ohne Ergebniss...
So wie es jetzt ist wird per Knopfdruck nur die PThorn1.wav abgespielt...
Kann mir jemand sagen was ich falsch gemacht hab?
Danke schonmal im Vorraus
[lua]--
-- lizard2000
-- Specialization for lizard2000 mod
--
-- @author Stefan Geiger
-- @date 10/01/09
--
-- Copyright (C) GIANTS Software GmbH, Confidential, All Rights Reserved.
PThorn = {};
function PThorn.prerequisitesPresent(specializations)
return SpecializationUtil.hasSpecialization(Motorized, specializations);
end;
function PThorn:load(xmlFile)
horn1SoundFile = Utils.getFilename("PThorn1.wav", self.baseDirectory);
horn2SoundFile = Utils.getFilename("PThorn2.wav", self.baseDirectory);
self.horn1SoundId = createSample("PThorn1sound");
self.horn2SoundId = createSample("PThorn2sound");
loadSample(self.horn1SoundId, horn1SoundFile, false);
loadSample(self.horn2SoundId, horn2SoundFile, false);
self.horn1Playing = false;
self.horn2Playing = false;
end;
function PThorn:delete()
delete(self.burnerSoundId);
end;
function PThorn:mouseEvent(posX, posY, isDown, isUp, button)
end;
function PThorn:keyEvent(unicode, sym, modifier, isDown)
end;
function PThorn:update(dt)
if self:getIsActiveForInput() and self:getIsActiveForSound() and InputBinding.isPressed(InputBinding.PThorn1) then
if not self.horn1Playing then
playSample(self.horn1SoundId, 0, 0.35, 0);
self.horn1Playing = true;
end;
else
if self.horn1Playing then
stopSample(self.horn1SoundId);
self.horn1Playing = false;
end;
end;
if self:getIsActiveForInput() and self:getIsActiveForSound() and InputBinding.isPressed(InputBinding.PThorn2) then
if not self.horn2Playing then
playSample(self.horn2SoundId, 0, 0.35, 0);
self.horn2Playing = true;
end;
else
if self.horn2Playing then
stopSample(self.horn2SoundId);
self.horn2Playing = false;
end;
end;
end;
function PThorn:draw()
end;
[/lua]