Page 11 of 13 FirstFirst ... 78910111213 LastLast
Results 101 to 110 of 125

Thread: Metroid:Return of the SA-X development

                  
   
  1. #101
    GP2X Coder/Moderator
    Join Date
    Jan 2006
    Posts
    1,678
    Rep Power
    84

    Default

    Quick hack fix
    Note that I changed the images because I dont have any of them. The code I added could use cleaning depending on your coding style. Your main problem is that are lots of variables that were out of scope of the areas that needed them. Eg. Direction, currentBullet, oldpad.
    ---------player loading--------

    player1 = Image.load("player.png")
    player2 = Image.load("player.png")
    player3 = Image.load("player.png")
    player4 = Image.load("player.png")
    morphball = Image.load("player.png")

    -------backgound and other loading---

    background = Image.load("player.png")
    bullet = Image.load("bullet.png")
    bullet1 = Image.load("bullet.png")
    ----player properties----

    player = {}
    player.img= player1
    player.gravity = 190
    player.y = 100
    player.x = 200
    player.jumpspeed = 10
    player.jumpstate = "ground"

    --Create Array for Bullets
    BulletInfo = {}
    for a = 1,5 do
    BulletInfo[a] = { pic = bullet , firing = false, direction = "right", x = player.x + 32,
    y = player.y + 16 }
    end

    currentBullet = 1

    function bulletSetup(direction)
    --Increase the current bullet by one, or reset it to 1
    if currentBullet < 5 then
    currentBullet = currentBullet + 1
    else
    currentBullet = 1
    end


    if direction == "left" then
    BulletInfo[currentBullet].x = player.x
    BulletInfo[currentBullet].y = player.y + 16
    end
    if direction == "right" then
    BulletInfo[currentBullet].x = player.x + 32
    BulletInfo[currentBullet].y = player.y + 16
    end

    BulletInfo[currentBullet].direction = direction
    BulletInfo[currentBullet].firing = true
    end


    function bulletFire()
    for i = 1,5 do
    if BulletInfo[i].firing == true then
    if BulletInfo[i].direction == "right" then BulletInfo[i].x = BulletInfo[i].x + 10 end
    if BulletInfo[i].direction == "left" then BulletInfo[i].x = BulletInfo[i].x - 10 end
    if BulletInfo[i].direction == "up" then BulletInfo[i].y = BulletInfo[i].y - 10 end
    if BulletInfo[i].direction == "down" then BulletInfo[i].y = BulletInfo[i].y + 10 end
    screen:blit(BulletInfo[i].x,BulletInfo[i].y,BulletInfo[i].pic)
    end
    if BulletInfo[i].x < 0 or BulletInfo[i].x > 480 or BulletInfo[i].y < 0 or BulletInfo[i].y > 272 then
    BulletInfo[i].firing = false
    end
    end
    end

    playerdirection = "right"

    function move()

    rand=math.random(1,2)

    if pad:left() and rand==1 then
    player.x= player.x -4
    player.img= player3
    playerdirection = "left"
    end

    if pad:left() and rand==2 then
    player.x= player.x -4
    player.img= player4
    playerdirection = "left"
    end

    if pad:right() and rand==1 then
    player.x=player.x +4
    player.img= player1
    playerdirection = "right"
    end

    if pad:right() and rand==2 then
    player.x= player.x +4
    player.img= player2
    playerdirection = "right"
    end
    end

    pad = Controls.read()
    oldpad = pad

    while true do
    oldpad = pad
    pad = Controls.read()
    screen:clear()

    move()

    screen:blit(0,0,background,false)

    if pad:cross() and player.jumpstate == "ground" then player.jumpstate = "jumping"
    end

    if pad:circle() and oldpad:circle() ~= pad:circle() then
    bulletSetup(playerdirection)
    end

    if pad:down() and player.jumpstate == "ground" then
    player.img = morphball
    end

    if pad:right() and player.img == morphball then
    player.x=player.x-4
    end

    if pad:left() and player.img == morphball then

    player.x=player.x+4
    end

    if player.x >= 445 then
    screen:clear()
    dofile "credits.lua"
    end

    if player.jumpstate == "jumping" then
    player.jumpspeed = player.jumpspeed - 0.5
    player.gravity = player.gravity - player.jumpspeed
    end

    if player.gravity < 0 then
    player.jumpstate = "falling"
    end

    if player.gravity < 190 and player.jumpstate == "falling" then
    player.gravity = player.gravity + (player.jumpspeed + 3)
    end


    if player.gravity == 190 then
    player.jumpspeed = 10
    player.jumpstate = "ground"
    end

    if player.gravity > 190 then player.gravity = 230 end
    player.y = player.gravity
    screen:blit(player.x,player.y,player.img)

    bulletFire()

    screen.flip()
    screen.waitVblankStart()
    end

  2. #102
    DCEmu Coder ninja9393's Avatar
    Join Date
    Dec 2005
    Location
    Space Pirate Homeworld
    Age
    33
    Posts
    1,028
    Rep Power
    82

    Default

    now it only shoots once each time
    thanks yaustar

  3. #103
    GP2X Coder/Moderator
    Join Date
    Jan 2006
    Posts
    1,678
    Rep Power
    84

    Default

    It shoots 5 for mine.

  4. #104
    DCEmu Coder ninja9393's Avatar
    Join Date
    Dec 2005
    Location
    Space Pirate Homeworld
    Age
    33
    Posts
    1,028
    Rep Power
    82

    Default

    Quote Originally Posted by yaustar
    It shoots 5 for mine.
    no i am sying it dosent shoot like one hundered each time u press circle
    it shoots once for each time u press circle

  5. #105
    GP2X Coder/Moderator
    Join Date
    Jan 2006
    Posts
    1,678
    Rep Power
    84

    Default

    So its a good thing right?

  6. #106
    DCEmu Coder ninja9393's Avatar
    Join Date
    Dec 2005
    Location
    Space Pirate Homeworld
    Age
    33
    Posts
    1,028
    Rep Power
    82

    Default

    version 1.5 released

  7. #107
    DCEmu Coder ninja9393's Avatar
    Join Date
    Dec 2005
    Location
    Space Pirate Homeworld
    Age
    33
    Posts
    1,028
    Rep Power
    82

    Default

    if i made missles would i need a whole new bullet system for the missles or can i use the same one and load it w/ a diffrent pic???

  8. #108
    GP2X Coder/Moderator
    Join Date
    Jan 2006
    Posts
    1,678
    Rep Power
    84

    Default

    You can use the latter method:
    "i use the same one and load it w/ a diffrent pic???"

    You might want to have the bullets have a 'type' so that you can check if a bullet is a missile or a standard beam for damage calculation.

  9. #109
    DCEmu Coder ninja9393's Avatar
    Join Date
    Dec 2005
    Location
    Space Pirate Homeworld
    Age
    33
    Posts
    1,028
    Rep Power
    82

    Default

    ok school is starting for me again
    but i will still try to work on this game a hour and a half a day
    and on weekends maybe even more

    i have been very wrong about my realease dates so dont thak this as an positive one but 2.0 should be ready in 8/21/06

    features will include
    missles
    morhball bomb's
    morphball animation
    healthbar
    gameover screen
    ability to go into 2 other rooms

  10. #110
    DCEmu Newbie
    Join Date
    Feb 2006
    Posts
    30
    Rep Power
    0

    Default

    just one thing m8, the animation of samus is not correct, her legs move to fast.

    great mod

Page 11 of 13 FirstFirst ... 78910111213 LastLast

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Tags for this Thread

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •