my code
[code]
module(…, package.seeall)
function clean ( event )
Particles.CleanUp() ----- THIS I DON’T UNDERSTAND which event ?
DIRECTOR CLASS 1.1
I MAKING A CLEANUP WHEN USER TAP BUTTON
end
function new ()
local menuGroup = display.newGroup()
local ui = require(“ui”)
local physics = require(“physics”)
local tapSound = audio.loadSound( “blip.wav” )
local menuTheme = audio.loadStream( “menuTheme.wav” )
physics.start()
physics.setGravity(0,5)
local theTimer
Particles.CreateEmitter(“Beams” , 240, 120, 0, false, true)
local Properties = {}
Properties.imagePath = “beam.png”
Properties.imageWidth = 128 – PARTICLE IMAGE WIDTH (newImageRect)
Properties.imageHeight = 32 – PARTICLE IMAGE HEIGHT (newImageRect)
Properties.xReference = -64 – SET IMAGE REFERENCE TO LEFT IMAGE BORDER
Properties.velocityStart = 0 – PIXELS PER SECOND
Properties.alphaStart = 0 – PARTICLE START ALPHA
Properties.fadeInSpeed = 1.0 – PER SECOND
Properties.fadeOutSpeed = -1.0 – PER SECOND
Properties.fadeOutDelay = 1000 – WHEN TO START FADE-OUT
Properties.scaleStart = 0.75 – PARTICLE START SIZE
Properties.scaleVariation = 1.25 – RANDOM SCALE VARIATION
Properties.rotationVariation = 360 – RANDOM ROTATION
Properties.rotationChange = 10 – ROTATION CHANGE PER SECOND
Properties.weight = 0 – PARTICLE WEIGHT (>0 FALLS DOWN, <0 WILL RISE UPWARDS)
Properties.emissionShape = 0 – 0 = POINT, 1 = LINE, 2 = RING, 3 = DISC
Properties.killOutsideScreen = true – PARENT LAYER MUST NOT BE NESTED OR ROTATED!
Properties.lifeTime = 2000 – MAX. LIFETIME OF A PARTICLE
Particles.CreateParticleType (“BeamParticles”, Properties)
Particles.AttachParticleType(“Beams” , “BeamParticles” , 5, 99999, 0)
Particles.StartEmitter(“Beams”)
Particles.StartAutoUpdate()
menuGroup:insert(Particles.GetEmitter(“Beams”))
local drawMenu = function()
local playButton
local infoButton
local openButton
local playTaped = function(event)
if event.phase == “release” then
audio.play( tapSound )
Particles.CleanUp() -----------------HERE MAKING A CLEANUP
director:changeScene(“levels”, “fade”)
end
end
local infoTaped = function(event)
if event.phase == “release” then
audio.play( tapSound )
Particles.CleanUp() -------------- HERE MAKING A CLEANUP
director:changeScene(“credits”, “fade”)
end
end
playButton= ui.newButton{
defaultSrc = “playButton.png”,
defaultX = 140,
defaultY = 42,
overSrc = “playButton.png”,
overX = 150,
overY = 52,
onEvent = playTaped,
id = “PlayButton”,
text = “”,
font = “Helvetica”,
textColor = { 255, 255, 255, 255 },
size = 16,
emboss = false
}
playButton:setReferencePoint(display.BottomCenterReferencePoint)
playButton.x = 240
playButton.y = 200
menuGroup:insert(playButton)
physics.addBody(playButton, “static” , {density = 1.0, friction = 0.3, bounce = 0.2 })
infoButton= ui.newButton{
defaultSrc = “creditsButton.png”,
defaultX = 140,
defaultY = 42,
overSrc = “creditsButton.png”,
overX = 150,
overY = 52,
onEvent = infoTaped,
id = “PlayButton”,
text = “”,
font = “Helvetica”,
textColor = { 255, 255, 255, 255 },
size = 16,
emboss = false
}
infoButton:setReferencePoint(display.BottomCenterReferencePoint)
infoButton.x = 80
infoButton.y = 200
menuGroup:insert(infoButton)
infoButton:toFront()
physics.addBody(infoButton, “static” , {density = 1.0, friction = 0.3, bounce = 0.2 })
openButton= ui.newButton{
defaultSrc = “optionsButton.png”,
defaultX = 140,
defaultY = 42,
overSrc = “optionsButton.png”,
overX = 150,
overY = 52,
onEvent = infoTaped,
id = “PlayButton”,
text = “”,
font = “Helvetica”,
textColor = { 255, 255, 255, 255 },
size = 16,
emboss = false
}
openButton:setReferencePoint(display.BottomCenterReferencePoint)
openButton.x = 400
openButton.y = 200
menuGroup:insert(openButton)
openButton:toFront()
physics.addBody(openButton, “static” , {density = 1.0, friction = 0.3, bounce = 0.2 })
unloadMe = function()
…
…
end
drawMenu()
—audio.play( menuTheme, { channel=1, loops=-1, fadein=5000 } )
return menuGroup
end
[code]
but right now everything is ok when I put a new library from Mike. Why director class 1.2 doesn’t work I have no idea , but I thing is a small problem… or not [import]uid: 13156 topic_id: 7004 reply_id: 25287[/import]