How to write the main character

Help!! I have been having really newby problems, i just started, but i have been watching, and reading tutorials, still need help!! 

My beginning problem is the character, i just cant figure out the specific script for it, or any overall. The character is a locked character (he doesn’t move), and only his gun moves to shoot.

Plz, can anyone help, or show me where to look.

Also, (not as important), can anyone show me where i can get more information on tables and sprites that move from one side of the screen to the other. (point A-point B)

Thank You

I might have named this topic wrong :P, i need help there are almost 30 views, and maybe its because i named it how to write the main character

srry, but if you came looking for answers, follow this topic so you can check back when its answered :smiley:

Kkajr

No one can help you if you don’t show the code you have written so far. Provide us with the code relevant to the player object and the movement functions and someone may reply with an answer.

My beginning problem is the character, i just cant figure out the specific script for it, or any overall

“or any overall”

i know what you mean though, the character is placed in the middle of a sideways device(might not be important), and is locked, only his arm and gun move, and it is a touch based shooter, the arm and gun follow the touch, and no other animation required, my first problem is;

I cant figure out how to make the two part sprite animation (arm/gun and player), 

Second is after that ends up working, i cant find any source code or tutorials on how to make the “player” i don’t know how to make the correct event listener for the touch, everything i do, and the screen stays black, the only things i can get working are the background and 1 part sprite: local background =

display.newImage (“Grassland.png”)

myImage = display.newImage( “cannon.png”, 200, 217, true )

after i posted this i went looking into the Point A - Point B, which i have been using planes, 

–local level = 1

–local spawnCnt = 0

–local planeType = 1

local _W = display.contentWidth

local _H =  display.contentHeight

     planes = {}

     

     local function spawnPlane( _type )

        if _type == 1 then

            table.insert( planes, display.newImage(“plane1.png”) )    – plane image 1

            planes[#planes].life = 5

            planes[#planes].speed = 2

        elseif _type == 2 then

             table.insert( planes, display.newImage(“plane2.png”) )    – plane image 2

             planes[#planes].life = 10

             planes[#planes].speed = 3

        elseif _type == 3 then

             table.insert( planes, display.newImage(“plane3.png”) )    – plane image 2

             planes[#planes].life = 20

             planes[#planes].speed = 1

         spawnCnt = spawnCnt +1

         end

 --if spawnCnt == 45 then

  –  level = level + 1

   – planeType = planeType + 1

   – spawnCnt = 0    

    –    end

        planes[#planes].x = _W + 100                  

        planes[#planes].y = math.random(20,50)  

        transition.to( planes[#planes], { time = planes[#planes].speed * 1000, x = -200} )     

     end

    

      timer.performWithDelay(2000, spawnPlane( math.random(1,3) ), 10 )

these also are having problems, only 1 (randomized) plane comes in at its set speed, and that it for the action. You have to restart it if you wanna see another plane.

I might have named this topic wrong :P, i need help there are almost 30 views, and maybe its because i named it how to write the main character

srry, but if you came looking for answers, follow this topic so you can check back when its answered :smiley:

Kkajr

No one can help you if you don’t show the code you have written so far. Provide us with the code relevant to the player object and the movement functions and someone may reply with an answer.

My beginning problem is the character, i just cant figure out the specific script for it, or any overall

“or any overall”

i know what you mean though, the character is placed in the middle of a sideways device(might not be important), and is locked, only his arm and gun move, and it is a touch based shooter, the arm and gun follow the touch, and no other animation required, my first problem is;

I cant figure out how to make the two part sprite animation (arm/gun and player), 

Second is after that ends up working, i cant find any source code or tutorials on how to make the “player” i don’t know how to make the correct event listener for the touch, everything i do, and the screen stays black, the only things i can get working are the background and 1 part sprite: local background =

display.newImage (“Grassland.png”)

myImage = display.newImage( “cannon.png”, 200, 217, true )

after i posted this i went looking into the Point A - Point B, which i have been using planes, 

–local level = 1

–local spawnCnt = 0

–local planeType = 1

local _W = display.contentWidth

local _H =  display.contentHeight

     planes = {}

     

     local function spawnPlane( _type )

        if _type == 1 then

            table.insert( planes, display.newImage(“plane1.png”) )    – plane image 1

            planes[#planes].life = 5

            planes[#planes].speed = 2

        elseif _type == 2 then

             table.insert( planes, display.newImage(“plane2.png”) )    – plane image 2

             planes[#planes].life = 10

             planes[#planes].speed = 3

        elseif _type == 3 then

             table.insert( planes, display.newImage(“plane3.png”) )    – plane image 2

             planes[#planes].life = 20

             planes[#planes].speed = 1

         spawnCnt = spawnCnt +1

         end

 --if spawnCnt == 45 then

  –  level = level + 1

   – planeType = planeType + 1

   – spawnCnt = 0    

    –    end

        planes[#planes].x = _W + 100                  

        planes[#planes].y = math.random(20,50)  

        transition.to( planes[#planes], { time = planes[#planes].speed * 1000, x = -200} )     

     end

    

      timer.performWithDelay(2000, spawnPlane( math.random(1,3) ), 10 )

these also are having problems, only 1 (randomized) plane comes in at its set speed, and that it for the action. You have to restart it if you wanna see another plane.