Good day,
this should be a fairly easy one as I’m still new at Lua.
In the pinball example (Pinball Madness, http://developer.anscamobile.com/code/pinball-madness), when you press anywhere on the screen, it pulls the spring and flips the flippers. So I thought, why not make the flippers and the spring that shoots the ball independent. I wanted to make it so you have to touch the spring to make it pull back and shoot, and touch anywhere else to flip the flippers.
So I checked out this section:
local callSpring = function(event)
if(event.phase == "began") then
spring.pullBack()
pinballTableObjects.flipLeftFlipper()
pinballTableObjects.flipRightFlipper()
gameAudio.playFlipperSound()
end
if(event.phase == "ended") then
spring.shoot()
gameAudio.playPlungerSound()
pinballTableObjects.lowerLeftFlipper()
pinballTableObjects.lowerRightFlipper()
end
end
Runtime:addEventListener("touch", callSpring)
In the last line there is “Runtime:addEventListener(“touch”, callSpring)” I thought “Runtime” means “everywhere”. So I made it "spring:addEventListener(“touch”,callSpring)
However now nothing happens, no flipping and no spring pulling.
I tried some other things but it doesn’t work, which I think is because of a lack of basic understanding of something.
Could somebody clear this up for me and tell me how I could make it so the flippers and the spring are able to be activated independently?
Thanks. [import]uid: 65258 topic_id: 15928 reply_id: 315928[/import]
[import]uid: 71210 topic_id: 15928 reply_id: 59639[/import]