Hello Everyone!
I am having a strange problem:
- I have a sprite animation ( a star rotating) on my game and it is supposed to be called when two buttons match ( I have a matching game I am working on! ).
On the simulator, it works like a charm, but when I push onto an android device the animation (sprite) won’t show. Here’s the code snipet:
--requires--
local sprite = require("sprite")
.
.
.
.
local onCompleteStar = function()
local hitsheet = sprite.newSpriteSheet("hitsprite1.png", 120, 63)
local hitset = sprite.newSpriteSet (hitsheet, 1, 16)
sprite.add (hitset, "hit", 1, 16, 620, 1)
local hit = sprite.newSprite (hitset)
hit.x = lastButton.x --50
hit.y = lastButton.y --110
hit:prepare("hit")
timer.performWithDelay(120, hit:play(), 1)
--remove the stars
local removeStars = function(event)
hit.x = - 120
end
timer.performWithDelay(1200,removeStars, 1)
end
.
.
.
.
.
local poofDo = function()
local poofDoImage= display.newImageRect("do\_orb.png", 40, 40)
poofDoImage.x = lastButton.x;
poofDoImage.y = lastButton.y;
transition.to(poofDoImage, { 1400, alpha = 0, y = poofDoImage.y - 120, onComplete= onCompleteStar}) --calling the onCompleteStar
function removePoof\_1(event) poofDoImage:removeSelf() end;
timer.performWithDelay ( 1100, removePoof\_1 ,1 )
end
.
.
.
.
.
. --MORE CODE HERE
--snippet code for when the buttons match. Here's where the poofDo() function is called, which calls -- the sprite animation...
--If buttons DO match, remove buttons
elseif(lastButton.myName == object.myName ) then
lastButton:addEventListener("touch", lastButton)
if ( lastButton.myName and object.myName == 1) then
poofDo()
end
I hope this makes sense. Like I said earlier, this works perfectly on the simulator, but doesn’t show the animation on the device (android).
Your help will be much appreciated.
Thanks in advance [import]uid: 75258 topic_id: 17532 reply_id: 317532[/import]
[import]uid: 52491 topic_id: 17532 reply_id: 66653[/import]
Mas tô caminhando e estudando pra isso…