player:move won't work when creating player a certain way

When I create a player like this:

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)  

I cannot use the line player:move(xAmount, yAmount)inside a move function for a joystick.

Am I missing something?

Thanks!
[import]uid: 62961 topic_id: 11135 reply_id: 311135[/import]

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:

[code]
local function move( image, x, y )

image.x = image.x + x
image.y = image.y + y

end

move( player, 10, 0 )
[/code] [import]uid: 5833 topic_id: 11135 reply_id: 40430[/import]