It looks like you're new here. If you want to get involved, click one of these buttons!
local monster1BlinkTimer = Timer.new(math.random(1000, 5000)) local function monster1Blink() self.monster1Eye.mc:gotoAndPlay(1) monster1BlinkTimer:reset() monster1BlinkTimer:start() end monster1BlinkTimer:addEventListener(Event.TIMER, monster1Blink) monster1BlinkTimer:start() local monster2BlinkTimer = Timer.new(math.random(1000, 5000)) local function monster2Blink() self.monster2Eye.mc:gotoAndPlay(1) monster2BlinkTimer:reset() monster2BlinkTimer:start() end monster2BlinkTimer:addEventListener(Event.TIMER, monster2Blink) monster2BlinkTimer:start() local monster3BlinkTimer = Timer.new(math.random(1000, 5000)) local function monster3Blink() self.monster3Eye.mc:gotoAndPlay(1) monster3BlinkTimer:reset() monster3BlinkTimer:start() end monster3BlinkTimer:addEventListener(Event.TIMER, monster3Blink) monster3BlinkTimer:start() local monster4BlinkTimer = Timer.new(math.random(1000, 5000)) local function monster4Blink() self.monster4Eye.mc:gotoAndPlay(1) monster4BlinkTimer:reset() monster4BlinkTimer:start() end monster4BlinkTimer:addEventListener(Event.TIMER, monster4Blink) monster4BlinkTimer:start() local monster5BlinkTimer = Timer.new(math.random(1000, 5000)) local function monster5Blink() self.monster5Eye.mc:gotoAndPlay(1) monster5BlinkTimer:reset() monster5BlinkTimer:start() end monster5BlinkTimer:addEventListener(Event.TIMER, monster5Blink) monster5BlinkTimer:start() |
Comments
Thank you for the reply!
I've managed to consolidate the code by doing this ...
The scope of this level doesn't really get much bigger than 10 monster with random blinks and a few event listeners.
Would this still cause problems in your opinion?