I first setup a global [lua]local rand = math.random[/lua]
But I am not getting how to control it so that its not off the screen
this is the code to make a single apple image appear in random places
[lua]function _apple.new()
local aApple = display.newImageRect(“apple.png”, 39, 44)
aApple.x = rand(780 - aApple.contentWidth)
aApple.y = rand(900 / 2, screenH - aApple.contentHeight)
–aApple.x = 100; aApple.y = 550
aApple.ID = “Item_” … counter
return aApple
end[/lua]
Can please help me keep the apples on the screen!! Thanks
Jake
[import]uid: 51459 topic_id: 16625 reply_id: 316625[/import]
