When I create a player like this:
1 2 3 4 5 6 7 8 | local onPlayerSpawnObject = function(object) local layer = map:getTileLayer("Player") player = display.newImage(layer.group, "guy.png") physics.addBody(player, {density = 1.0, friction = 0.3, bounce = 0.2}) player.x = object.x player.y = object.y end map:addObjectListener("PlayerSpawn", onPlayerSpawnObject) |
The "move" function is only available to Tile objects whereas your player object is just a Corona display image.
You should be able to just do something like this though:
1 2 3 4 5 6 7 8 | local function move( image, x, y ) image.x = image.x + x image.y = image.y + y end move( player, 10, 0 ) |
views:1333 update:2011/10/13 16:30:09