character collision problrm

Hi,

i,m developing a game and i,m new in corona sdk framework…please find attached screen shoot. why my character cycle showing more then 1?

i have created this sprite sheet from texture pixer and also remove the collision through physics editor but i don,t know why collision is showing
 

please help me to figure out this issue.

Can you post your code for this scene?

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

What do you mean by this?

i have created this sprite sheet from texture pixer and also remove the collision through physics editor but i don,t know why collision is showing

You say that you’ve removed collision. Did you mean that you disabled physics? Because your code clearly shows that isn’t the case. There’s a lot of physics code still there.

If you actually meant that only one cyclist image is being shown whereas multiple physics objects have been created for it, then this is your problem –

The player_Data object contains physics information for the cyclist (generated by PhysicsEditor). You should not be using that in your graphics.newImageSheet and display.newSprite calls.

Your code currently looks like this –

sheet = graphics.newImageSheet("images/player.png",data, player\_Data:get("player")) player = display.newSprite(sheet, seqData, player\_Data:get("player"))

Change it to this –

local sheet = graphics.newImageSheet ( "images/player.png", data ) local player = display.newSprite ( sheet, seqData ) player : setSequence ( "player\_running" ) player : play ()

Also, don’t forget to insert all your display objects into the scene’s display group.

Can you post your code for this scene?

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

What do you mean by this?

i have created this sprite sheet from texture pixer and also remove the collision through physics editor but i don,t know why collision is showing

You say that you’ve removed collision. Did you mean that you disabled physics? Because your code clearly shows that isn’t the case. There’s a lot of physics code still there.

If you actually meant that only one cyclist image is being shown whereas multiple physics objects have been created for it, then this is your problem –

The player_Data object contains physics information for the cyclist (generated by PhysicsEditor). You should not be using that in your graphics.newImageSheet and display.newSprite calls.

Your code currently looks like this –

sheet = graphics.newImageSheet("images/player.png",data, player\_Data:get("player")) player = display.newSprite(sheet, seqData, player\_Data:get("player"))

Change it to this –

local sheet = graphics.newImageSheet ( "images/player.png", data ) local player = display.newSprite ( sheet, seqData ) player : setSequence ( "player\_running" ) player : play ()

Also, don’t forget to insert all your display objects into the scene’s display group.