Seite 165 von 342 ErsteErste ... 65 115 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 215 265 ... LetzteLetzte
Zeige Ergebnis 4.921 bis 4.950 von 10238

Lua Programming Help Thread

This is a discussion on Lua Programming Help Thread within the PSP Development Forum forums, part of the PSP Development, Hacks, and Homebrew category; yea i know...*sighs* and i already made lots of changes to the code to make it smaller, but there hasnt ...

  
  1. #4921
    QJ Gamer Green
    Points: 13.310, Level: 75
    Level completed: 15%, Points required for next Level: 340
    Overall activity: 0%

    Registriert seit
    Dec 2005
    Ort
    Here
    Beiträge
    2.715
    Points
    13.310
    Level
    75
    Downloads
    0
    Uploads
    0

    Standard

    yea i know...*sighs* and i already made lots of changes to the code to make it smaller, but there hasnt been any actual speed changes. it sucks going back to look over what you did to see whats wrong, cause while making it you think itll all work fine, so how is it youll find whats wrong? you know? thats the point where i'm at. everything works, just not as fast as i'd hoped. not without the cpu getting a little juice.


    [CENTER][IMG]http://img148.imageshack.us/img148/6985/siglw8.jpg[/IMG][/CENTER]

  2. #4922
    Your Fate is Grim...
    Points: 11.640, Level: 70
    Level completed: 98%, Points required for next Level: 10
    Overall activity: 0%

    Registriert seit
    Oct 2005
    Beiträge
    2.269
    Points
    11.640
    Level
    70
    Downloads
    0
    Uploads
    0

    Standard

    Zitat Zitat von EminentJonFrost
    yea i know...*sighs* and i already made lots of changes to the code to make it smaller, but there hasnt been any actual speed changes. it sucks going back to look over what you did to see whats wrong, cause while making it you think itll all work fine, so how is it youll find whats wrong? you know? thats the point where i'm at. everything works, just not as fast as i'd hoped. not without the cpu getting a little juice.

    if you trust me enough, PM me with your code. there is simply no way a lua game should go below 50 FPS. you can use the cpu boost as well, but it would also be good if you could improve your code a bit too.
    --------------------------------------------------------------------------------------

  3. #4923
    QJ Gamer Gold
    Points: 11.629, Level: 70
    Level completed: 95%, Points required for next Level: 21
    Overall activity: 0%

    Registriert seit
    Aug 2006
    Beiträge
    1.633
    Points
    11.629
    Level
    70
    Downloads
    0
    Uploads
    0

    Standard

    Yea if youd like Ill help you look over your code and if youve got an IM ill show you things to remember to make your code more efficient.

  4. #4924
    QJ Gamer Blue
    Points: 4.561, Level: 43
    Level completed: 6%, Points required for next Level: 189
    Overall activity: 0%

    Registriert seit
    May 2006
    Beiträge
    224
    Points
    4.561
    Level
    43
    Downloads
    0
    Uploads
    0

    Standard

    is there any way on of you two could do the same for me? I am coding a Super Mario Bros. game (it still isn't done and has bugs of course), and it seems to run okay on the computer, but on my PSP parts are really slow.

    i really need to know more efficient ways of doing things becuase i can always seem to be able to make a program do something, yet it usually isn't the best way to do it.

    any help would be greatly appreciated

  5. #4925
    QJ Gamer Gold
    Points: 11.629, Level: 70
    Level completed: 95%, Points required for next Level: 21
    Overall activity: 0%

    Registriert seit
    Aug 2006
    Beiträge
    1.633
    Points
    11.629
    Level
    70
    Downloads
    0
    Uploads
    0

    Standard

    Sure, if you've got MSN or AIM add me and send me an IM and Ill be glad to help you out.

  6. #4926
    QJ Gamer Blue
    Points: 4.031, Level: 40
    Level completed: 41%, Points required for next Level: 119
    Overall activity: 0%

    Registriert seit
    Aug 2006
    Ort
    c:\Program Files\World of Warcraft\WoW.exe
    Beiträge
    98
    Points
    4.031
    Level
    40
    Downloads
    0
    Uploads
    0

    Standard

    Heres the download to the game i was working on: http://www.megaupload.com/?d=O8IQGJHF

    its not that great...
    It's my first lua game though.

  7. #4927
    QJ Gamer Silver
    Points: 7.740, Level: 58
    Level completed: 95%, Points required for next Level: 10
    Overall activity: 0%

    Registriert seit
    Jan 2006
    Beiträge
    608
    Points
    7.740
    Level
    58
    Downloads
    0
    Uploads
    0

    Standard

    I was wondering how to set up some code to kill an enemy when you shoot them or something, example

    Code:
    function collisionCheckbullets(object)
    if (bullet.x + bulletWidth > object.x) and (bullet.x < object.x + object.width) and (bullet.y + bulletHeight > object.y) and (bullet.y < object.y + object.height) then
    *Insert Make Enemy Dissapear/Die Script Here*
    end
    end

  8. #4928
    QJ Gamer Gold
    Points: 11.629, Level: 70
    Level completed: 95%, Points required for next Level: 21
    Overall activity: 0%

    Registriert seit
    Aug 2006
    Beiträge
    1.633
    Points
    11.629
    Level
    70
    Downloads
    0
    Uploads
    0

    Standard

    Well, add a variable called alive to your enemy table and set it to true.

    enemy = {alive = true, x = blah, y = blah, img = blah, blah, blah}

    And then only do stuff related to the enemy when alive is true.

    if enemy.alive then
    --AI related stuff for enemy
    screen:blit(enemy.x,enemy .y,enemy.img)
    end

    And then make it so that enemy.alive becomes false when he is shot:

    if collision(enemy,bullet) then enemy.alive = false end

  9. #4929
    Ponies and Unicorns
    Points: 5.778, Level: 49
    Level completed: 14%, Points required for next Level: 172
    Overall activity: 0%

    Registriert seit
    Aug 2006
    Ort
    Pelennor Fields
    Beiträge
    547
    Points
    5.778
    Level
    49
    Downloads
    0
    Uploads
    0

    Standard

    Why is this unstickied. And why is no one posting here anymore? tisk tisk. Ok ill spark it up with a question that doesnt really need to be answered now but I have to ask it sometime.

    How would I make it check for text files? If if one is not found then print an error? I could look this up but I know someone here has the answer on the tip of thier tongue so you can save me some time lol.
    If you play WoW come find me on DOOMHAMMER (US) I am Human mage lvl 64 Atrana is the name (dont ask for runs!)
    Gold donations are highly appreciated!

  10. #4930
    QJ Gamer Silver
    Points: 7.278, Level: 56
    Level completed: 64%, Points required for next Level: 72
    Overall activity: 0%

    Registriert seit
    Oct 2006
    Ort
    Pimp'en in the US F#
    Beiträge
    1.254
    Points
    7.278
    Level
    56
    Downloads
    0
    Uploads
    0

    Standard

    good idea, I wouldn't mind being able to do that aswell!
    The Wentire Worls in two Sectors....
    When did I get dev statz?
    Spoiler for my PSP homebrewReleases:
    Ace of Space V1|PvP Pong Online|PvP Pong v3 | 3.03 BlackShark Custom Firmware
    (PvP Pong DL'ed well over 2403 times combined! get yours now!)
    Spoiler for Great Quotes:

    "No Snowflake in an Avalanche ever feels responsible....." - Fortune Cookie.

  11. #4931
    QJ Gamer Silver
    Points: 7.740, Level: 58
    Level completed: 95%, Points required for next Level: 10
    Overall activity: 0%

    Registriert seit
    Jan 2006
    Beiträge
    608
    Points
    7.740
    Level
    58
    Downloads
    0
    Uploads
    0

    Standard

    Zitat Zitat von TacticalPinguin
    Well, add a variable called alive to your enemy table and set it to true.

    enemy = {alive = true, x = blah, y = blah, img = blah, blah, blah}

    And then only do stuff related to the enemy when alive is true.

    if enemy.alive then
    --AI related stuff for enemy
    screen:blit(enemy.x,enemy .y,enemy.img)
    end

    And then make it so that enemy.alive becomes false when he is shot:

    if collision(enemy,bullet) then enemy.alive = false end
    Thanks alot

  12. #4932
    QJ Gamer Silver
    Points: 7.278, Level: 56
    Level completed: 64%, Points required for next Level: 72
    Overall activity: 0%

    Registriert seit
    Oct 2006
    Ort
    Pimp'en in the US F#
    Beiträge
    1.254
    Points
    7.278
    Level
    56
    Downloads
    0
    Uploads
    0

    Standard

    Zitat Zitat von GuitarGod1134
    Why is this unstickied. And why is no one posting here anymore? tisk tisk. Ok ill spark it up with a question that doesnt really need to be answered now but I have to ask it sometime.

    How would I make it check for text files? If if one is not found then print an error? I could look this up but I know someone here has the answer on the tip of thier tongue so you can save me some time lol.
    any body have any idea how to do this?
    The Wentire Worls in two Sectors....
    When did I get dev statz?
    Spoiler for my PSP homebrewReleases:
    Ace of Space V1|PvP Pong Online|PvP Pong v3 | 3.03 BlackShark Custom Firmware
    (PvP Pong DL'ed well over 2403 times combined! get yours now!)
    Spoiler for Great Quotes:

    "No Snowflake in an Avalanche ever feels responsible....." - Fortune Cookie.

  13. #4933
    lol
    Points: 20.859, Level: 91
    Level completed: 2%, Points required for next Level: 491
    Overall activity: 0%

    Registriert seit
    Aug 2006
    Ort
    Whittier, CA
    Beiträge
    5.791
    Points
    20.859
    Level
    91
    Downloads
    0
    Uploads
    0

    Standard

    Sticked. :)

  14. #4934
    Ponies and Unicorns
    Points: 5.778, Level: 49
    Level completed: 14%, Points required for next Level: 172
    Overall activity: 0%

    Registriert seit
    Aug 2006
    Ort
    Pelennor Fields
    Beiträge
    547
    Points
    5.778
    Level
    49
    Downloads
    0
    Uploads
    0

    Standard

    Good job pspgamer81
    If you play WoW come find me on DOOMHAMMER (US) I am Human mage lvl 64 Atrana is the name (dont ask for runs!)
    Gold donations are highly appreciated!

  15. #4935
    QJ Gamer Gold
    Points: 11.629, Level: 70
    Level completed: 95%, Points required for next Level: 21
    Overall activity: 0%

    Registriert seit
    Aug 2006
    Beiträge
    1.633
    Points
    11.629
    Level
    70
    Downloads
    0
    Uploads
    0

    Standard

    Checking for a text file:

    if io.open("nameoffile.txt", "r") then
    --File exists
    else
    --File doesn't exist
    end

  16. #4936
    words are stones in my <3
    Points: 35.274, Level: 100
    Level completed: 0%, Points required for next Level: 0
    Overall activity: 0%

    Registriert seit
    Jul 2005
    Ort
    Spokane
    Beiträge
    5.008
    Points
    35.274
    Level
    100
    My Mood
    Lonely
    Downloads
    1
    Uploads
    0

    Standard

    Correction, checking for ANY file... Just not a directory.

    ...at what speed must I live.. to be able to see you again?...

    Projects

    You can support my Open World 3D RPG for PSP by voting for it here


  17. #4937
    QJ Gamer Gold
    Points: 11.629, Level: 70
    Level completed: 95%, Points required for next Level: 21
    Overall activity: 0%

    Registriert seit
    Aug 2006
    Beiträge
    1.633
    Points
    11.629
    Level
    70
    Downloads
    0
    Uploads
    0

    Standard

    But if you're checking for a non text file then you have to change its extension.

    But yes that can be used for checking for any file.

  18. #4938
    QJ Gamer Silver
    Points: 7.740, Level: 58
    Level completed: 95%, Points required for next Level: 10
    Overall activity: 0%

    Registriert seit
    Jan 2006
    Beiträge
    608
    Points
    7.740
    Level
    58
    Downloads
    0
    Uploads
    0

    Standard

    Hmm, Does anyone know whats wrong with my game,

    It's very...basic so far but it is so sluggish! I even put in an FPS counter and it just shows 'NaN' and every now and then for a split second 1000fps o_O

    It runs fine on the pc so I'm not sure whats wrong =\

  19. #4939
    Your Fate is Grim...
    Points: 11.640, Level: 70
    Level completed: 98%, Points required for next Level: 10
    Overall activity: 0%

    Registriert seit
    Oct 2005
    Beiträge
    2.269
    Points
    11.640
    Level
    70
    Downloads
    0
    Uploads
    0

    Standard

    Zitat Zitat von Dark_Merlin
    Hmm, Does anyone know whats wrong with my game,

    It's very...basic so far but it is so sluggish! I even put in an FPS counter and it just shows 'NaN' and every now and then for a split second 1000fps o_O

    It runs fine on the pc so I'm not sure whats wrong =\

    post your code. 1000 means your FPS counter is wrong.the FPS shouldnt go over 60, because of the screen.waitVblankStart() function, which limits it to 60.
    --------------------------------------------------------------------------------------

  20. #4940
    QJ Gamer Silver
    Points: 7.740, Level: 58
    Level completed: 95%, Points required for next Level: 10
    Overall activity: 0%

    Registriert seit
    Jan 2006
    Beiträge
    608
    Points
    7.740
    Level
    58
    Downloads
    0
    Uploads
    0

    Standard

    EDIT: New code with the Animation Lib FPS counter... now displaying just 0 EDIT2: Tabbed my code to make it easier to understand
    Spoiler for Code:
    System.usbDiskModeActivat e()
    dofile ("requireC.lua")
    requireC ("FPSCounter.lua")
    requireC ("colors.lua")

    --Load Images
    player = Image.load("player.jpg")
    enemy = Image.load("enemy.jpg")
    bullet = Image.load("bullet.png")

    --Variables
    playerHeight = 32
    playerWidth = 32
    bulletHeight = 4
    bulletWidth = 4
    direction = "right"
    movespeed = 2
    ammo = 10
    math.randomseed(os.time() )

    --Arrays
    Player = { x = 30, y = 100 }

    Enemy = {}
    Enemy[1] = { x = 100, y = 80, height = enemy:height(), width = enemy:width() }
    Enemy[2] = { x = 330, y = 10, height = enemy:height(), width = enemy:width() }
    Enemy[3] = { x = 450, y = 58, height = enemy:height(), width = enemy:width() }

    BulletInfo = {}
    for a = 1,100 do
    BulletInfo[a] = { pic = bullet , firing = false, direction = "right", x = Player.x + 32, y = Player.y + 16 }
    end

    --Functions

    function enemyOOB( )
    for a = 1,3 do
    if Enemy[a].x > 480 - 32 then
    Enemy[a].x = Enemy[a].x - 2
    end
    if Enemy[a].x < 32 then
    Enemy[a].x = Enemy[a].x + 2
    end
    if Enemy[a].y > 272 - 32 then
    Enemy[a].y = Enemy[a].y - 2
    end
    if Enemy[a].y < 0 then
    Enemy[a].y = Enemy[a].y + 2
    end
    end
    end

    function playerOOB( )
    if Player.x > 480 - 32 then
    Player.x = Player.x - 2
    end
    if Player.x < 0 then
    Player.x = Player.x + 2
    end
    if Player.y > 272 - 32 then
    Player.y = Player.y - 2
    end
    if Player.y < 0 then
    Player.y = Player.y + 2
    end
    end

    function enemyTooClose( )
    stallclose = math.random(3)
    if stallclose == 1 then
    for a = 1,3 do
    if Enemy[1].x > Enemy[2].x and Enemy[3].x then
    Enemy[1].x = Enemy[1].x +2
    elseif Enemy[1].y < Enemy[2].y and Enemy[3].y then
    Enemy[1].y = Enemy[1].y -2
    end
    end
    stallclose2 = math.random(3)
    if stallclose2 == 1 then
    if Enemy[2].x > Enemy[1].x and Enemy[3].x then
    Enemy[2].x = Enemy[2].x +2
    elseif Enemy[2].y < Enemy[1].y and Enemy[3].y then
    Enemy[2].y = Enemy[2].y -2
    end
    end
    stallclose3 = math.random(3)
    if stallclose3 == 1 then
    if Enemy[3].x > Enemy[2].x and Enemy[1].x then
    Enemy[3].x = Enemy[3].x +2
    elseif Enemy[3].y < Enemy[2].y and Enemy[1].y then
    Enemy[3].y = Enemy[3].y -2
    end
    end
    end
    end

    function chasePlayer()
    for a = 1,3 do
    stallchase = math.random(2)
    if stallchase == 1 then
    if Enemy[a].x > Player.x then
    Enemy[a].x = Enemy[a].x - 2
    elseif Enemy[a].x < Player.x then
    Enemy[a].x = Enemy[a].x + 2
    end
    end
    stallchase = math.random(2)
    if stallchase == 1 then
    if Enemy[a].y > Player.y then
    Enemy[a].y = Enemy[a].y - 2
    elseif Enemy[a].y < Player.y then
    Enemy[a].y = Enemy[a].y + 2
    end
    end
    end
    end --///end the function///

    function bulletSetup()
    ammo = ammo - 1
    if direction == "downleft" then
    BulletInfo[currentBullet].x = Player.x
    BulletInfo[currentBullet].y = Player.y + 32
    end
    if direction == "upleft" then
    BulletInfo[currentBullet].x = Player.x
    BulletInfo[currentBullet].y = Player.y
    end
    if direction == "upright" then
    BulletInfo[currentBullet].x = Player.x + 32
    BulletInfo[currentBullet].y = Player.y
    end
    if direction == "downright" then
    BulletInfo[currentBullet].x = Player.x +32
    BulletInfo[currentBullet].y = Player.y + 32
    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
    if direction == "up" then
    BulletInfo[currentBullet].x = Player.x + 16
    BulletInfo[currentBullet].y = Player.y
    end
    if direction == "down" then
    BulletInfo[currentBullet].x = Player.x + 16
    BulletInfo[currentBullet].y = Player.y + 32
    end
    BulletInfo[currentBullet].direction = direction
    BulletInfo[currentBullet].firing = true
    end

    function bulletFire()
    for i = 1,100 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
    if BulletInfo[i].direction == "downleft" then BulletInfo[i].y = BulletInfo[i].y + 10 BulletInfo[i].x = BulletInfo[i].x - 10 end
    if BulletInfo[i].direction == "upleft" then BulletInfo[i].y = BulletInfo[i].y - 10 BulletInfo[i].x = BulletInfo[i].x - 10 end
    if BulletInfo[i].direction == "upright" then BulletInfo[i].y = BulletInfo[i].y - 10 BulletInfo[i].x = BulletInfo[i].x + 10 end
    if BulletInfo[i].direction == "downright" then BulletInfo[i].y = BulletInfo[i].y + 10 BulletInfo[i].x = BulletInfo[i].x + 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

    function movePlayer()
    pad = Controls.read()
    pad2 = Controls.read( )
    if pad:left() then
    Player.x = Player.x - movespeed
    direction = "left"
    end
    if pad:right() then
    Player.x = Player.x + movespeed
    direction = "right"
    end
    if pad:up() then
    Player.y = Player.y - movespeed
    direction = "up"
    end
    if pad:down() then
    Player.y = Player.y + movespeed
    direction = "down"
    end
    if pad:left( ) and pad2:down( ) then
    direction = "downleft"
    end
    if pad:left() and pad2:up( ) then
    direction = "upleft"
    end
    if pad:right() and pad2:up( ) then
    direction = "upright"
    end
    if pad:right() and pad2:down( ) then
    direction = "downright"
    end
    end

    function FPS( )
    local counter = FPSCounter.new()
    screen:print(2,2,"FPS: " .. counter:update(),white)
    end

    --Main Loop
    while true do
    pad = Controls.read( )
    pad2 = Controls.read( )
    oldx = Player.x
    oldy = Player.y
    currentBullet = ammo
    screen:clear( )

    screen:blit(Player.x,Play er.y,player)

    for a = 1,3 do
    screen:blit(Enemy[a].x,Enemy[a].y,enemy)
    end

    if pad:cross() and oldpad:cross() ~= pad:cross() and ammo > 0 then
    bulletSetup()
    end

    movePlayer( )
    bulletFire( )
    chasePlayer( )
    enemyTooClose( )
    enemyOOB( )
    playerOOB( )
    FPS( )

    screen:print (0,50, ammo, green)

    screen.waitVblankStart()
    screen.flip()
    oldpad = pad
    end
    Geändert von Dark_Merlin (01-09-2007 um 01:54 PM Uhr)

  21. #4941
    QJ Gamer Blue
    Points: 6.041, Level: 50
    Level completed: 46%, Points required for next Level: 109
    Overall activity: 0%

    Registriert seit
    Aug 2006
    Ort
    Missouri
    Beiträge
    451
    Points
    6.041
    Level
    50
    Downloads
    0
    Uploads
    0

    Standard

    How do I keep an image from disapearing when I release the button the blitted it to the screen?

  22. #4942
    QJ Gamer Silver
    Points: 7.740, Level: 58
    Level completed: 95%, Points required for next Level: 10
    Overall activity: 0%

    Registriert seit
    Jan 2006
    Beiträge
    608
    Points
    7.740
    Level
    58
    Downloads
    0
    Uploads
    0

    Standard

    Here you go
    Code:
    image = Image.load("image")
    
    while true do
       pad = Controls.read()
       oldpad = pad
       if pad:cross() or oldpad:cross() then
          screen:blit(0,0, image) 
       end
    screen.waitVblankStart()
    screen.flip()
    end
    Geändert von Dark_Merlin (01-08-2007 um 08:16 PM Uhr)

  23. #4943
    QJ Gamer Blue
    Points: 6.041, Level: 50
    Level completed: 46%, Points required for next Level: 109
    Overall activity: 0%

    Registriert seit
    Aug 2006
    Ort
    Missouri
    Beiträge
    451
    Points
    6.041
    Level
    50
    Downloads
    0
    Uploads
    0

    Standard

    Now it doesn't load the script at all. Can you explain to me the "end" after the blitting of the image, and the oldpad stuff?

  24. #4944
    QJ Gamer Gold
    Points: 11.629, Level: 70
    Level completed: 95%, Points required for next Level: 21
    Overall activity: 0%

    Registriert seit
    Aug 2006
    Beiträge
    1.633
    Points
    11.629
    Level
    70
    Downloads
    0
    Uploads
    0

    Standard

    Zitat Zitat von Dark_Merlin
    Code:
    image = Image.load("image")
    
    while true do
    pad = Controls.read()
    oldpad = pad
    if pad:cross() or oldpad:cross() then
    screen:blit(0,0, image) 
    end
    screen.waitVblankStart()
    screen.flip()
    end
    Umm, 1. That's only going to blit the image for 1 frame.

    2. You messed up oldpad very badly.

    Anyways something like this:
    oldpad = Controls.read()
    while true do
    pad = Controls.read()
    if viewingimage then screen:blit(0,0,image) end
    if pad:cross() and not oldpad:cross() and not viewingimage then viewingimage = true end
    if pad:cross() and not oldpad:cross() and viewingimage then viewingimage = false end
    screen.waitVblankStart()
    screen.flip()
    oldpad = pad
    end

    Thatll make x toggle between showing the image and not showing it.

  25. #4945
    QJ Gamer Silver
    Points: 7.740, Level: 58
    Level completed: 95%, Points required for next Level: 10
    Overall activity: 0%

    Registriert seit
    Jan 2006
    Beiträge
    608
    Points
    7.740
    Level
    58
    Downloads
    0
    Uploads
    0

    Standard

    Ok with the fps is wrong thing, i replaced that fps counter with the one out of alatnet's Animated Sprite Lib and now it just shows up as 0 on the comp, im going to test it on the psp now...

    EDIT: Ok the psp shows the same thing.

    and what I posted for him was a full program, sorry and yeah I did oldpad wrong, sorry

  26. #4946
    QJ Gamer Blue
    Points: 6.041, Level: 50
    Level completed: 46%, Points required for next Level: 109
    Overall activity: 0%

    Registriert seit
    Aug 2006
    Ort
    Missouri
    Beiträge
    451
    Points
    6.041
    Level
    50
    Downloads
    0
    Uploads
    0

    Standard

    So confuzed.

    index.lua
    Code:
    white = Color.new(255,255,255)
    menustatus = 1
    menu = Image.load("images/menu.png")
    cursor = Image.load("images/cursor.png")
    multiplayer = Image.load("images/multiplayer.png")
    singleplayer = Image.load("images/singleplayer.png")
    singleplayer2 = Image.load("images/singleplayer2.png")
    oldpad = Controls.read()
    while true do
    pad = Controls.read()
    dofile("menu.lua")
    screen.waitVblankStart()
    screen.flip()
    oldpad = pad
    end
    menu.lua
    Code:
    screen:clear(white)
    screen:blit(0,0,menu)
    if menustatus == 1 then
    screen:blit(280,172,cursor)
    end
    if menustatus == 2 then
    screen:blit(280,196,cursor)
    end
    if pad:down() and oldpad:down() ~= pad:down() then
    menustatus = menustatus + 1
    end
    if pad:up() and oldpad:up() ~= pad:up() then
    menustatus = menustatus - 1
    end
    if menustatus == 0 then
    menustatus = 1
    end
    if menustatus == 3 then
    menustatus = 2
    end
    if pad:circle() and menustatus == 1 then
    dofile("singleplayer.lua")
    end
    if pad:circle() and menustatus == 2 then
    dofile("multiplayer.lua")
    end
    singleplayer.lua
    Code:
    screen:clear(white)
    screen:blit(0,0,singleplayer)
    if pad:r() and pad:l() and pad:circle() then
    screen:clear(white)
    screen:blit(0,0,singleplayer2)
    menustatus = menustatus - 1
    Maybe that will help you determine why when I load an image it won't loop.

  27. #4947
    QJ Gamer Silver
    Points: 7.740, Level: 58
    Level completed: 95%, Points required for next Level: 10
    Overall activity: 0%

    Registriert seit
    Jan 2006
    Beiträge
    608
    Points
    7.740
    Level
    58
    Downloads
    0
    Uploads
    0

    Standard

    Are you trying to make it so the l + r + circle blit and keep the singleplayer2?

    Wait are you saying your menu images arent staying blitted?
    Geändert von Dark_Merlin (01-08-2007 um 08:47 PM Uhr)

  28. #4948
    Your Fate is Grim...
    Points: 11.640, Level: 70
    Level completed: 98%, Points required for next Level: 10
    Overall activity: 0%

    Registriert seit
    Oct 2005
    Beiträge
    2.269
    Points
    11.640
    Level
    70
    Downloads
    0
    Uploads
    0

    Standard

    Zitat Zitat von Cheez Pirate
    So confuzed.

    index.lua
    Code:
    white = Color.new(255,255,255)
    menustatus = 1
    menu = Image.load("images/menu.png")
    cursor = Image.load("images/cursor.png")
    multiplayer = Image.load("images/multiplayer.png")
    singleplayer = Image.load("images/singleplayer.png")
    singleplayer2 = Image.load("images/singleplayer2.png")
    oldpad = Controls.read()
    while true do
    pad = Controls.read()
    dofile("menu.lua")
    screen.waitVblankStart()
    screen.flip()
    oldpad = pad
    end
    menu.lua
    Code:
    screen:clear(white)
    screen:blit(0,0,menu)
    if menustatus == 1 then
    screen:blit(280,172,cursor)
    end
    if menustatus == 2 then
    screen:blit(280,196,cursor)
    end
    if pad:down() and oldpad:down() ~= pad:down() then
    menustatus = menustatus + 1
    end
    if pad:up() and oldpad:up() ~= pad:up() then
    menustatus = menustatus - 1
    end
    if menustatus == 0 then
    menustatus = 1
    end
    if menustatus == 3 then
    menustatus = 2
    end
    if pad:circle() and menustatus == 1 then
    dofile("singleplayer.lua")
    end
    if pad:circle() and menustatus == 2 then
    dofile("multiplayer.lua")
    end
    singleplayer.lua
    Code:
    screen:clear(white)
    screen:blit(0,0,singleplayer)
    if pad:r() and pad:l() and pad:circle() then
    screen:clear(white)
    screen:blit(0,0,singleplayer2)
    menustatus = menustatus - 1
    Maybe that will help you determine why when I load an image it won't loop.

    ok, im not even gonna TRY to read that. you need to start spacing and indenting. it will make your problems much easier to identify and solve.
    --------------------------------------------------------------------------------------

  29. #4949
    QJ Gamer Silver
    Points: 7.740, Level: 58
    Level completed: 95%, Points required for next Level: 10
    Overall activity: 0%

    Registriert seit
    Jan 2006
    Beiträge
    608
    Points
    7.740
    Level
    58
    Downloads
    0
    Uploads
    0

    Standard

    I think he needs to put in some loops in the other files right?

    From what i see he only has one loop in the index.lua and none in the others, that would be where his only blitting for one frame problems are coming from right?

    If im wrong sorry, I havnt worked with calling other files of your code in before.

  30. #4950
    QJ Gamer Blue
    Points: 6.041, Level: 50
    Level completed: 46%, Points required for next Level: 109
    Overall activity: 0%

    Registriert seit
    Aug 2006
    Ort
    Missouri
    Beiträge
    451
    Points
    6.041
    Level
    50
    Downloads
    0
    Uploads
    0

    Standard

    My main menu image ("menu") stays blitted but the other 2 only last until you let go of the button. and l + r + o are supposed to load the next singleplayer menu. I'll true putting loops in other files though.


 

Tags for this Thread

Forumregeln

  • Es ist Ihnen nicht erlaubt, neue Themen zu verfassen.
  • Es ist Ihnen nicht erlaubt, auf Beiträge zu antworten.
  • Es ist Ihnen nicht erlaubt, Anhänge hochzuladen.
  • Es ist Ihnen nicht erlaubt, Ihre Beiträge zu bearbeiten.
  •  





Alle Zeitangaben in WEZ -8. Es ist jetzt 08:58 PM Uhr.

Use of this Web site constitutes acceptance of the TERMS & CONDITIONS and PRIVACY POLICY
Copyright © , Caputo Media, LLC. All Rights Reserved. Cluster .