function spawnPlayerObject(xPlayerSpawn,yPlayerSpawn,richTurn) --spawns Rich where we need him.
– riches sprite sheet and all his inital spirites. We need to adjust this so that animations 3-6 are the only ones that animate when moving horizontally
local richPlayer = sprite.newSpriteSet(richSheet1,1,6)
sprite.add(richPlayer, “rich”, 1,6,500,1)
rich = sprite.newSprite(richPlayer)
rich.x = xPlayerSpawn
rich.y = yPlayerSpawn
rich:scale(_W*0.0009, _W*0.0009) – scale is used to adjust the size of the object.
richDir = richTurn
rich.rotation = richDir
physics.addBody( rich, “static”, { friction=1, radius = 15 } ) – needs a better physics body for collision detection.
end
ok this is what i have now. And what i mean is that the player draws a line and then the character follows it after completion and animates the sprite set on the line. here is what we have for that.
function movePlayerOnLine(event)
–for the original image replace all rich with player.
if posCount ~= linePart then
richDir = math.atan2(ractgangle_hit[posCount].y-rich.y,ractgangle_hit[posCount].x-rich.x)*180/math.pi
playerSpeed = 5
rich.x = rich.x + math.cos(richDir*math.pi/180)*playerSpeed
rich.y = rich.y + math.sin(richDir*math.pi/180)*playerSpeed
if rich.x < ractgangle_hit[posCount].x+playerSpeed*10 and rich.x > ractgangle_hit[posCount].x-playerSpeed*10 then
if rich.y < ractgangle_hit[posCount].y+playerSpeed*10 and rich.y > ractgangle_hit[posCount].y-playerSpeed*10 then
posCount = posCount + 1
end
end
right now it works but it is not animating. [import]uid: 94237 topic_id: 16941 reply_id: 63646[/import]