hi, i am building a “bubble wrap” game where you need to pop as many bubbles as possible in a set amount of time. this is my first attempt at the corona SDK so please make your help as dumb-ed down as possible xD
i created my menu and made it load the actual game, i am now trying to make the bubbles “pop”. to do this i am trying to replace the image with a “bubbleDown.png” image, my problem is that when i hit a bubble anywhere on the screen it creates a new image of “bubbleDown” near the top left of the screen
can anyone tell me what i am doing wrong please?
-----------------------------------------------------------------------------------------
–
– view2.lua
–
local storyboard = require( “storyboard” )
local scene = storyboard.newScene()
– BEGINNING OF YOUR IMPLEMENTATION
–
– NOTE: Code outside of listener functions (below) will only be executed once,
– unless storyboard.removeScene() is called.
–
– Called when the scene’s view does not exist:
function scene:createScene( event )
local group = self.view
– create a white background to fill screen
local bg = display.newImage(‘bgG.png’ )
local titleBar = display.newRect(0,0,display.contentWidth,15)
titleBar:setFillColor(75,0,0)
– all objects must be added to group (e.g. self.view)
group:insert( bg )
group:insert( titleBar )
-------------------------------create the bubbles------------------------------------------
local count = 1
local bubble = {}
for i=9,display.contentWidth,19 do
for j=19,display.contentHeight,19 do
bubble[count] = display.newImage(‘bubble.png’ )
bubble[count].x = i
bubble[count].y = j
group:insert( bubble[count] )
bubble[count]:addEventListener(“tap”, bubbleTap)
count = count+1
end
end
-------------------------------------------------------------------------------------------
end
– Called immediately after scene has moved onscreen:
function scene:enterScene( event )
local group = self.view
– do nothing
end
– Called when scene is about to move offscreen:
function scene:exitScene( event )
local group = self.view
– INSERT code here (e.g. stop timers, remove listenets, unload sounds, etc.)
end
– If scene’s view is removed, scene:destroyScene() will be called just prior to:
function scene:destroyScene( event )
local group = self.view
– INSERT code here (e.g. remove listeners, remove widgets, save state variables, etc.)
end
function bubbleTap( event )
local self = event.target
self = display.newImage( ‘bubbleDown.png’ )
end
– END OF YOUR IMPLEMENTATION
– “createScene” event is dispatched if scene’s view does not exist
scene:addEventListener( “createScene”, scene )
– “enterScene” event is dispatched whenever scene transition has finished
scene:addEventListener( “enterScene”, scene )
– “exitScene” event is dispatched whenever before next scene’s transition begins
scene:addEventListener( “exitScene”, scene )
– “destroyScene” event is dispatched before view is unloaded, which can be
– automatically unloaded in low memory situations, or explicitly via a call to
– storyboard.purgeScene() or storyboard.removeScene().
scene:addEventListener( “destroyScene”, scene )
return scene
any help would be more than appreciated 