local _W = display.contentWidth;
local _H = display.contentHeight;
display.setStatusBar( display.HiddenStatusBar )
local physics = require(“physics”)
physics.start()
physics.setDrawMode(“hybrid”)
local player_Data = (require “cycle”).physicsData(1.0)
motionx = 0; – Variable used to move character along x axis
local background1 = display.newImage(“images/background.png”, true);
background1.x = _W/8
background1.y = _H/2
local background2 = display.newImage(“images/background.png”, true);
background2.x = _W/2
background2.y = _H/2
seqData = {
{ name = “player_running”, start = 1, count = 5, time = 250, loopCount = 0 },
}
data = {
frames = {
{
– character
x=2, y=2, width=252, height=228, },
{
– character1
x=256, y=2, width=252, height=228, },
{
--character2
x=510, y=2, width=252, height=228,},
{
--character3
x=764, y=2, width=252, height=228, },
{
– character4
x=1018, y=2, width=252, height=228, },
{
– character5
x=1272, y=2, width=252, height=228, },
{
– character6
x=1526, y=2, width=252, height=227, },
},
sheetContentWidth = 1780,
sheetContentHeight = 232
}
sheet = graphics.newImageSheet(“images/player.png”,data, player_Data:get(“player”))
player = display.newSprite(sheet, seqData, player_Data:get(“player”))
player.x = 15-(display.contentWidth/8.5);
player.y = display.contentHeight/5.5;
player:play()
physics.addBody(player, “dynamic”, player_Data:get(“player”))
road = display.newImageRect(“images/road.png”,1000,20);
road.x = 500-_W
road.y = 950-_H
physics.addBody(road, “static”,{bounce = 0.2})
ruff = display.newImage(“1.png”,50,50)
physics.addBody(ruff, “dynamic”)
please check full code and please help me to solve this problem