Hello, I am new to Corona. I was wondering how I can use Beebe class to pause my game.
This is my “level_1.lua” file.
module(..., package.seeall)
function new ()
local super = require("\_level\_1")
local this = super:newlevel\_1()
--------------------beebe game class--------------------
game = require( "beebegames" )
local resetTimeCounter = game.resetTimeCounter
local getCountedTime = game.getCountedTime
local performAfterDelay = game.performAfterDelay
local pauseAllTimers = game.pauseAllTimers()
local resumeAllTimers = game.resumeAllTimers()
local cancelAllTimers = game.cancelAllTimers()
--------------------physics--------------------
-- Setup Physics
local physics = require ("physics")
physics.start()
physics.setGravity (0,0)
--------------------ball--------------------
-- Load Ball
local ball = require("ball")
-- Movement Function
local function movement()
-- Get X & Y Accelerometer Input From Remote
local xAcceleration = remote.xGravity
local yAcceleration = remote.yGravity
-- Convert Input To Force
local xForce = xAcceleration \* 55
local yForce = yAcceleration \* 55
-- Apple Force To Ball
ball.applyForceToBall( xForce , -yForce )
end
Runtime:addEventListener( "enterFrame", movement )
--------------------level--------------------
-- Load level
local level = require("level")
--------------------Sign--------------------
local ui = require("ui")
local pause\_button = ui.newButton{
defaultSrc = imagelookup.table["Sign\_2"], defaultX = imagelookup.table["Sign\_2Width"], defaultY = imagelookup.table["Sign\_2Height"],
overSrc = imagelookup.table["Signover\_2"], overX = imagelookup.table["Signover\_2Width"], overY = imagelookup.table["Signover\_2Height"],
}
pause\_button.x = 260
pause\_button.y = 436.5
pause\_button.isVisible = true
this:insert(pause\_button)
this.pause\_button = pause\_button
return this
end
As you can see…the only thing that I have to pause is my “ball”.
How can I use beebe class to make it so that when you touch my “pause_button” it pauses the timers (just the ball)?
Thanks in advanced…sorry I am new to all this!
ps As you can see, I am also using corona remote with my gravity.
[import]uid: 15281 topic_id: 7009 reply_id: 307009[/import]