I need help with a part of my code. I’m just a newbie programmer (started a month ago), and I’m trying to spawn a monster where the user’s tap is (in the background). The monster is supposed to change it’s alpha from 0 to 1 in 5 milliseconds. However, when I run the code, it won’t spawn a monster where I click/tap it! Can someone please help me? Thanks!
(The “local monster” and “local startSpawning” is in the forward references.)
function startSpawning() monster = display.newImage("monster.png") monster.alpha = 0 local function spawnMonster(event) print( "This worked!" ) monster.x = event.x monster.y = event.y transition.to(monster, {time = 5, alpha =0}) end monster : addEventListener("tap", spawnMonster)end
