Seite 336 von 342 ErsteErste ... 236 286 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 LetzteLetzte
Zeige Ergebnis 10.051 bis 10.080 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; alright its been driving me crazy forever. Does LPHMv2 allow flash 0 access because I know how to code lua ...

  
  1. #10051
    QJ Gamer Blue
    Points: 2.716, Level: 31
    Level completed: 78%, Points required for next Level: 34
    Overall activity: 0%
    Achievements:
    First 1000 Experience Points

    Registriert seit
    May 2009
    Beiträge
    106
    Points
    2.716
    Level
    31
    Downloads
    0
    Uploads
    0

    Standard

    alright its been driving me crazy forever. Does LPHMv2 allow flash 0 access because I know how to code lua and so far Ive been unsuccessful? If I could get a solid answer to this it would settle my nerves



  2. #10052
    Developer and Tutor.
    Points: 8.736, Level: 62
    Level completed: 96%, Points required for next Level: 14
    Overall activity: 0%

    Registriert seit
    Jul 2007
    Ort
    Widnes, England
    Beiträge
    1.649
    Points
    8.736
    Level
    62
    My Mood
    Happy
    Downloads
    0
    Uploads
    0

    Standard

    Zitat Zitat von scionsamurai Beitrag anzeigen
    is their a command like screen.waitVblankStart() but for a single image? That just shows the image for a bit. i know of a long way to do it.
    -make a timer
    --make it so the timer starts at like 5 seconds
    ---make the image display while the timer is greater than zero
    but this seams like to much of a pain to me
    yeah its a pain but you have to do it that way

    Zitat Zitat von thecraziness1 Beitrag anzeigen
    alright its been driving me crazy forever. Does LPHMv2 allow flash 0 access because I know how to code lua and so far Ive been unsuccessful? If I could get a solid answer to this it would settle my nerves
    yeah but i dont think it works properly
    ------ FaT3oYCG -----
    AKA Craig, call me what you want to It's your preference.
    My Website: http://www.modern-gamer.co.uk/

    Currently working on:
    (0) MediaGrab
    (0) PGE Gears Of War - On hold (Very large project).
    (0) PS???? -On Hold A tactical 2d side scrolling game involving AI and online multiplayer features. - Tile engine nearley finished (1 bug to fix).

  3. #10053
    QJ Gamer Green
    Points: 4.034, Level: 40
    Level completed: 43%, Points required for next Level: 116
    Overall activity: 0%

    Registriert seit
    Jul 2008
    Beiträge
    467
    Points
    4.034
    Level
    40
    Downloads
    0
    Uploads
    0

    Standard

    Zitat Zitat von xXChromeXx Beitrag anzeigen
    Can someone help me with a level editor? I don't know where to start.
    Can someone at least describe how to do it. I'm stumped. Its for a breakout game.
    My Releases:
    ---------------------------------------------------
    [URL="http://forums.qj.net/showthread.php?t=145654"]ROFLFlasher[/URL]

    [URL="http://forums.qj.net/showthread.php?t=144892"]DTS MGS Edition[/URL]

    [URL="http://forums.qj.net/showthread.php?t=143735"]Arkanoid Deluxe Beta[/URL]

    [URL="http://forums.qj.net/showthread.php?p=2144700#post2144700"]SAVIOR![/URL]

  4. #10054
    QJ Gamer Blue
    Points: 2.716, Level: 31
    Level completed: 78%, Points required for next Level: 34
    Overall activity: 0%
    Achievements:
    First 1000 Experience Points

    Registriert seit
    May 2009
    Beiträge
    106
    Points
    2.716
    Level
    31
    Downloads
    0
    Uploads
    0

    Standard

    yeah i can access and write and to flash 1 and I can read from flash 0 I just cant write to it. It says that it is writing to it so I know nothing is wrong with my code its just when you go to see if it actually wrote the file/files to flash 0 and it doesnt? Any one know if it just doesnt function right or is there a way around it. Thanks in advance to anyone that helps.

  5. #10055
    Developer and Tutor.
    Points: 8.736, Level: 62
    Level completed: 96%, Points required for next Level: 14
    Overall activity: 0%

    Registriert seit
    Jul 2007
    Ort
    Widnes, England
    Beiträge
    1.649
    Points
    8.736
    Level
    62
    My Mood
    Happy
    Downloads
    0
    Uploads
    0

    Standard

    i have told many people many times HM is very buggy flash access is buggy along with other things, there is no way to fix the bugs that is down to HM himself.

    you always have the alternative to switching to PGE it currently does not have many of the functions that HM does but with the release of 0.03 it will support module loading meaning that for example someone like me could create a module that could be loaded that would allow specific extra functions

    Zitat Zitat von xXChromeXx Beitrag anzeigen
    Can someone at least describe how to do it. I'm stumped. Its for a breakout game.
    what do you mean a level editor all it is is blocks on the screen?
    Geändert von FaT3oYCG (07-03-2009 um 11:42 AM Uhr) Grund: hehe
    ------ FaT3oYCG -----
    AKA Craig, call me what you want to It's your preference.
    My Website: http://www.modern-gamer.co.uk/

    Currently working on:
    (0) MediaGrab
    (0) PGE Gears Of War - On hold (Very large project).
    (0) PS???? -On Hold A tactical 2d side scrolling game involving AI and online multiplayer features. - Tile engine nearley finished (1 bug to fix).

  6. #10056
    QJ Gamer Green
    Points: 4.034, Level: 40
    Level completed: 43%, Points required for next Level: 116
    Overall activity: 0%

    Registriert seit
    Jul 2008
    Beiträge
    467
    Points
    4.034
    Level
    40
    Downloads
    0
    Uploads
    0

    Standard

    To make the layouts of the blocks.
    My Releases:
    ---------------------------------------------------
    [URL="http://forums.qj.net/showthread.php?t=145654"]ROFLFlasher[/URL]

    [URL="http://forums.qj.net/showthread.php?t=144892"]DTS MGS Edition[/URL]

    [URL="http://forums.qj.net/showthread.php?t=143735"]Arkanoid Deluxe Beta[/URL]

    [URL="http://forums.qj.net/showthread.php?p=2144700#post2144700"]SAVIOR![/URL]

  7. #10057
    Developer and Tutor.
    Points: 8.736, Level: 62
    Level completed: 96%, Points required for next Level: 14
    Overall activity: 0%

    Registriert seit
    Jul 2007
    Ort
    Widnes, England
    Beiträge
    1.649
    Points
    8.736
    Level
    62
    My Mood
    Happy
    Downloads
    0
    Uploads
    0

    Standard

    1. decide the format of the file the levels will be in
    2. code reading the file into ur game
    3. code analysing the code you have read in
    4. code turning those analysations into displaying the blocks for that level
    5. im not going to code it for you, im making my own things (unless you pay me XD)
    ------ FaT3oYCG -----
    AKA Craig, call me what you want to It's your preference.
    My Website: http://www.modern-gamer.co.uk/

    Currently working on:
    (0) MediaGrab
    (0) PGE Gears Of War - On hold (Very large project).
    (0) PS???? -On Hold A tactical 2d side scrolling game involving AI and online multiplayer features. - Tile engine nearley finished (1 bug to fix).

  8. #10058
    Lua guy
    Points: 11.690, Level: 71
    Level completed: 10%, Points required for next Level: 360
    Overall activity: 0%

    Registriert seit
    Jan 2008
    Ort
    Wales, cardiff
    Beiträge
    1.442
    Points
    11.690
    Level
    71
    My Mood
    Blah
    Downloads
    0
    Uploads
    0

    Standard

    Wouldn't even be hard.
    I mean, it's one screen, you don't have to take into account any sort of scrolling at all(though that is easy as-well).
    You need some sort of cursor to move the tiles. A variable to hold the current selected tile, layer changing (the easiest way is using a bool).
    For a understandable way to write a 2d array to a file view the scripts/examples thread.
    With the way i did my function it took two values. mapX & mapY. Basically i have a little mini-menu where i enter the size of my map, then it creates the map & there you go.
    to load a map i simply do:
    mapX = #map[1]
    mapY = #map

    It's as easy as that. Though if you don't really understand tile-maps then your gunna have trouble.

  9. #10059
    QJ Gamer Green
    Points: 4.034, Level: 40
    Level completed: 43%, Points required for next Level: 116
    Overall activity: 0%

    Registriert seit
    Jul 2008
    Beiträge
    467
    Points
    4.034
    Level
    40
    Downloads
    0
    Uploads
    0

    Standard

    Thanks thats what I needed
    My Releases:
    ---------------------------------------------------
    [URL="http://forums.qj.net/showthread.php?t=145654"]ROFLFlasher[/URL]

    [URL="http://forums.qj.net/showthread.php?t=144892"]DTS MGS Edition[/URL]

    [URL="http://forums.qj.net/showthread.php?t=143735"]Arkanoid Deluxe Beta[/URL]

    [URL="http://forums.qj.net/showthread.php?p=2144700#post2144700"]SAVIOR![/URL]

  10. #10060
    QJ Gamer Bronze
    Points: 7.257, Level: 56
    Level completed: 54%, Points required for next Level: 93
    Overall activity: 0%

    Registriert seit
    Dec 2007
    Ort
    B.F.
    Beiträge
    328
    Points
    7.257
    Level
    56
    My Mood
    Psychedelic
    Downloads
    1
    Uploads
    0

    Standard

    I was wondering about if anyone has already used these LPHM's v7 built in functions:

    Code:
    System.startGameSave() 
    System.startGameLoad()
    How should i proceed to custom the Save file it retrieves with my own PIC1.png and ICON0.png images ?

    Another question else, assuming i have saved something just this way:
    Code:
    System.startGameSave("Info", "Info", "Details",string_saved)
    This work, but I guess i can do this to load information saved and store it into a variable:

    Code:
    loaded_data = System.startGameLoad()
    The fact is doesn't return anything.
    Geändert von seanpaul223 (07-07-2009 um 08:47 AM Uhr)
    00:00: Windows is loading...Come back tomorrow.
    01:00 : Booting done.Not yet errors encountered...
    01:10: Fatal error.Windows has been detected on logical drive
    01:22: Keyboard Locked, try everything.
    01:42 : Mouse Device Pilot not found, or uninstalled.Press Left-Bouton to continue.
    01:50 : Ending User session.Do you want to play another game ?
    01:59: Not enough memory.Only 508'312'583 bytes available.
    02:00 : System is shutting Down.

  11. #10061
    Lua guy
    Points: 11.690, Level: 71
    Level completed: 10%, Points required for next Level: 360
    Overall activity: 0%

    Registriert seit
    Jan 2008
    Ort
    Wales, cardiff
    Beiträge
    1.442
    Points
    11.690
    Level
    71
    My Mood
    Blah
    Downloads
    0
    Uploads
    0

    Standard

    I think those functions don't work in HM7 (bugged), though supposedly fixed in HMv2 but i can't confirm that.

  12. #10062
    Developer and Tutor.
    Points: 8.736, Level: 62
    Level completed: 96%, Points required for next Level: 14
    Overall activity: 0%

    Registriert seit
    Jul 2007
    Ort
    Widnes, England
    Beiträge
    1.649
    Points
    8.736
    Level
    62
    My Mood
    Happy
    Downloads
    0
    Uploads
    0

    Standard

    no those ones actually work but when loading you need to pass the name that you gave to the sace i think it is the "info1" as you call it but i cant be sure of which one is the name for the save.
    ------ FaT3oYCG -----
    AKA Craig, call me what you want to It's your preference.
    My Website: http://www.modern-gamer.co.uk/

    Currently working on:
    (0) MediaGrab
    (0) PGE Gears Of War - On hold (Very large project).
    (0) PS???? -On Hold A tactical 2d side scrolling game involving AI and online multiplayer features. - Tile engine nearley finished (1 bug to fix).

  13. #10063
    Points: 1.695, Level: 23
    Level completed: 95%, Points required for next Level: 5
    Overall activity: 0%
    Achievements:
    First 1000 Experience Points

    Registriert seit
    Jul 2009
    Beiträge
    12
    Points
    1.695
    Level
    23
    Downloads
    0
    Uploads
    0

    Standard

    Okay. this is probably the most noob post you will ever see. I want to code in Lua for the psp, but I have no clue where to start? I dont even know how to get Lua up and running, much less make a game with it.

    Can anyone explain how to get lua to work, and direct me to a tutorial? thanks.
    Geändert von EYEko (07-09-2009 um 04:44 PM Uhr)

  14. #10064
    Developer and Tutor.
    Points: 8.736, Level: 62
    Level completed: 96%, Points required for next Level: 14
    Overall activity: 0%

    Registriert seit
    Jul 2007
    Ort
    Widnes, England
    Beiträge
    1.649
    Points
    8.736
    Level
    62
    My Mood
    Happy
    Downloads
    0
    Uploads
    0

    Standard

    use pge lua player - luaplayer.org click pge then download it has instructions on how to install i think

    pge lua hello world tutorial - my website modern-gamer.tk click on the link, ill make more eventually, if you have any suggestions then feel free to tell me.
    ------ FaT3oYCG -----
    AKA Craig, call me what you want to It's your preference.
    My Website: http://www.modern-gamer.co.uk/

    Currently working on:
    (0) MediaGrab
    (0) PGE Gears Of War - On hold (Very large project).
    (0) PS???? -On Hold A tactical 2d side scrolling game involving AI and online multiplayer features. - Tile engine nearley finished (1 bug to fix).

  15. #10065
    Lua guy
    Points: 11.690, Level: 71
    Level completed: 10%, Points required for next Level: 360
    Overall activity: 0%

    Registriert seit
    Jan 2008
    Ort
    Wales, cardiff
    Beiträge
    1.442
    Points
    11.690
    Level
    71
    My Mood
    Blah
    Downloads
    0
    Uploads
    0

    Standard

    search programming in lua, lua manual, lua-wiki in google. Read & (hopefully) understand?

  16. #10066
    QJ Gamer Blue
    Points: 2.716, Level: 31
    Level completed: 78%, Points required for next Level: 34
    Overall activity: 0%
    Achievements:
    First 1000 Experience Points

    Registriert seit
    May 2009
    Beiträge
    106
    Points
    2.716
    Level
    31
    Downloads
    0
    Uploads
    0

    Standard

    i have a file browser and I need it to program runeboot when you choose a file.
    I tried to run ext. = pbp but not working any ideas the browser is already fully functional just cant get the variable right to run chosen EBOOT.pbp. Im on LPHMv2 if it matters. Thanx in advance !!!!!!

  17. #10067
    QJ Gamer Gold
    Points: 13.372, Level: 75
    Level completed: 31%, Points required for next Level: 278
    Overall activity: 0%

    Registriert seit
    Nov 2008
    Ort
    CAD
    Beiträge
    693
    Points
    13.372
    Level
    75
    Downloads
    19
    Uploads
    4

    Standard

    can you post your variables?
    That epic dude.

  18. #10068
    Lua guy
    Points: 11.690, Level: 71
    Level completed: 10%, Points required for next Level: 360
    Overall activity: 0%

    Registriert seit
    Jan 2008
    Ort
    Wales, cardiff
    Beiträge
    1.442
    Points
    11.690
    Level
    71
    My Mood
    Blah
    Downloads
    0
    Uploads
    0

    Standard

    use string.sub() to find end of filename i.e

    if string.sub(listOfFiles[currentSelecter].name, -4) == ".pbp" then

  19. #10069
    QJ Gamer Blue
    Points: 2.716, Level: 31
    Level completed: 78%, Points required for next Level: 34
    Overall activity: 0%
    Achievements:
    First 1000 Experience Points

    Registriert seit
    May 2009
    Beiträge
    106
    Points
    2.716
    Level
    31
    Downloads
    0
    Uploads
    0

    Standard

    Here is my code Im working with. Its not the whole code but the part of the code that controls running the eboot.
    It works and it looks like its gonna launch the eboot but then it takes you back to the XMB and you get the cannot run game error.

    Thanks in advance ! ! !

    if pad:cross() and not oldpad:cross() then
    if not fbrowser.fl[fbrowser.s].directory then
    if string.lower(string.sub(f browser.fl[fbrowser.s].name, -4)) == ".pbp" then

    System.runeboot("ms0:/psp/game/'fbrowser.fl[fbrowser.s].name'/eboot.pbp")
    end
    elseif fbrowser.fl[fbrowser.s].directory then
    System.currentDirectory(f browser.fl[fbrowser.s].name)
    fbrowser.s = 1
    fbrowser.fl=System.listDi rectory()
    fbrowser.nf=table.getn(fb rowser.fl)
    fbrowser.ls = 1

    end
    end

    screen.waitVblankStart()
    screen.flipscreen()

    oldpad = pad
    if pad:start() then break end

    end


  20. #10070
    Lua guy
    Points: 11.690, Level: 71
    Level completed: 10%, Points required for next Level: 360
    Overall activity: 0%

    Registriert seit
    Jan 2008
    Ort
    Wales, cardiff
    Beiträge
    1.442
    Points
    11.690
    Level
    71
    My Mood
    Blah
    Downloads
    0
    Uploads
    0

    Standard

    What game/app did you try to run?

  21. #10071
    QJ Gamer Blue
    Points: 2.716, Level: 31
    Level completed: 78%, Points required for next Level: 34
    Overall activity: 0%
    Achievements:
    First 1000 Experience Points

    Registriert seit
    May 2009
    Beiträge
    106
    Points
    2.716
    Level
    31
    Downloads
    0
    Uploads
    0

    Standard

    any and it wont work. Just always get the same error message. Any Ideas ??? Do you want me to paste the entire code?

  22. #10072
    QJ Gamer Gold
    Points: 13.372, Level: 75
    Level completed: 31%, Points required for next Level: 278
    Overall activity: 0%

    Registriert seit
    Nov 2008
    Ort
    CAD
    Beiträge
    693
    Points
    13.372
    Level
    75
    Downloads
    19
    Uploads
    4

    Standard

    try this:
    Code:
    System.runeboot(System.currentDirectory().."/"..fbrowser.fl[fbrowser.s].name)
    That epic dude.

  23. #10073
    QJ Gamer Blue
    Points: 2.716, Level: 31
    Level completed: 78%, Points required for next Level: 34
    Overall activity: 0%
    Achievements:
    First 1000 Experience Points

    Registriert seit
    May 2009
    Beiträge
    106
    Points
    2.716
    Level
    31
    Downloads
    0
    Uploads
    0

    Standard

    No Dice. Ive tried all kinds of strings and still get the cannot run game error. I bet its something super simple 2 that im just overlooking. Any more ideas ?

  24. #10074
    QJ Gamer Gold
    Points: 13.372, Level: 75
    Level completed: 31%, Points required for next Level: 278
    Overall activity: 0%

    Registriert seit
    Nov 2008
    Ort
    CAD
    Beiträge
    693
    Points
    13.372
    Level
    75
    Downloads
    19
    Uploads
    4

    Standard

    try somethin' like this:
    Code:
    selection = 1
    System.currentDirectory("ms0:")
    files = System.listDirectory()
    length = string.len(files[selection].name)
    name = string.sub(fichiers[selection].name , length - 3)
    if name == ".pbp" or name == ".PBP" then
       System.runeboot(System.currentDirectory().."/"..files[selection].name)
    end
    just rename the variables' name to yours, it's just an example. you'll know how to put the right things into the right places;)
    That epic dude.

  25. #10075
    QJ Gamer Blue
    Points: 2.716, Level: 31
    Level completed: 78%, Points required for next Level: 34
    Overall activity: 0%
    Achievements:
    First 1000 Experience Points

    Registriert seit
    May 2009
    Beiträge
    106
    Points
    2.716
    Level
    31
    Downloads
    0
    Uploads
    0

    Standard

    thanx ill give it a shot in a while and i think it looks like it should work so ill let ya know ! ! !

  26. #10076
    Lua guy
    Points: 11.690, Level: 71
    Level completed: 10%, Points required for next Level: 360
    Overall activity: 0%

    Registriert seit
    Jan 2008
    Ort
    Wales, cardiff
    Beiträge
    1.442
    Points
    11.690
    Level
    71
    My Mood
    Blah
    Downloads
    0
    Uploads
    0

    Standard

    it's more or less the the same as your original method....also it's minus 4, there's 4 characters in .php
    I think the problem had something todo with your cases. Nearly every eboot i've seen is in UPPER CASE
    you had lower. Also even when you entered the directory i.e ms0:/...
    you again used lower case. & AGAIN every psp i've seen went PSP/SOMETHING you had psp/something.
    Most things are case sensitive and honestly i don't think this is any exception.
    I'm no HM expert but its worth a try.

  27. #10077
    QJ Gamer Blue
    Points: 2.716, Level: 31
    Level completed: 78%, Points required for next Level: 34
    Overall activity: 0%
    Achievements:
    First 1000 Experience Points

    Registriert seit
    May 2009
    Beiträge
    106
    Points
    2.716
    Level
    31
    Downloads
    0
    Uploads
    0

    Standard

    ya i appreciate your help. Its actually my same browser i used in my psjournal program and im just altering it to run eboots so as far as the basic programming i already know its functional and running its just the runeboot system call thats having problems. Thanks to both of you for your help. Ill talk 2 u again soon and let u know how it goes !
    -=Double Post Merge =-
    Thank You Mootjeuh !!!!!! Your Idea got me thinkin and I was able to twist it around a bit and get it to work. Just like I said in the beginning. It was something super simple that I was just overlooking ! Thanks to both of you for takin the time to help. Talk to you guys soon!
    Geändert von thecraziness1 (07-13-2009 um 09:40 PM Uhr) Grund: Automerged Doublepost

  28. #10078
    Points: 1.647, Level: 23
    Level completed: 47%, Points required for next Level: 53
    Overall activity: 0%
    Achievements:
    First 1000 Experience Points

    Registriert seit
    Jul 2009
    Beiträge
    2
    Points
    1.647
    Level
    23
    Downloads
    0
    Uploads
    0

    Standard

    i cant code lol

  29. #10079
    Developer and Tutor.
    Points: 8.736, Level: 62
    Level completed: 96%, Points required for next Level: 14
    Overall activity: 0%

    Registriert seit
    Jul 2007
    Ort
    Widnes, England
    Beiträge
    1.649
    Points
    8.736
    Level
    62
    My Mood
    Happy
    Downloads
    0
    Uploads
    0

    Standard

    some of your main problems seem to be that you dont understand the basic workings of the actual browser, seen as it is mostly identical to the one that Tactical_Penguin made that is probably why, if you searched into the functions that you are using and changed the variable names to somethingthat made sense to you then you would understand what was going on.

    also lua is case sensitive with file names and function names.
    ------ FaT3oYCG -----
    AKA Craig, call me what you want to It's your preference.
    My Website: http://www.modern-gamer.co.uk/

    Currently working on:
    (0) MediaGrab
    (0) PGE Gears Of War - On hold (Very large project).
    (0) PS???? -On Hold A tactical 2d side scrolling game involving AI and online multiplayer features. - Tile engine nearley finished (1 bug to fix).

  30. #10080
    Lua Coder
    Points: 18.915, Level: 87
    Level completed: 13%, Points required for next Level: 435
    Overall activity: 99,0%

    Registriert seit
    Jan 2008
    Ort
    Iowa
    Beiträge
    834
    Points
    18.915
    Level
    87
    My Mood
    Busy
    Downloads
    2
    Uploads
    0

    Standard

    im working on a point and click game in lua, i have the d-pad set up so if you click it it changes the frame. I have this code:
    Code:
    if currentpic == 1 then
    if pad:left() and checkpad:left() ~= pad:left()  and not pad:select() then
    currentpic = 2
    end
    if pad:right() and checkpad:right() ~= pad:right() and not pad:select() then
    currentpic = 3
    end
    end
    if currentpic == 2 then
    if pad:right() and checkpad:right() ~= pad:right() and not pad:select() then
    currentpic = 1
    end
    if pad:left() and checkpad:left() ~= pad:left()  and not pad:select() then
    currentpic = 4
    end
    end
    if currentpic == 3 then
    if pad:left() and checkpad:left() ~= pad:left()  and not pad:select() then
    currentpic = 1
    end
    if pad:right() and checkpad:right() ~= pad:right() and not pad:select() then
    currentpic = 4
    end
    end
    if currentpic == 4 then
    if pad:left() and checkpad:left() ~= pad:left()  and not pad:select() then
    currentpic = 3
    end
    if pad:right() and checkpad:right() ~= pad:right() and not pad:select() then
    currentpic = 2
    end
    end
    the code allows me to click the dpad and it determines the next pic to blit, it works fine for the first 3 pics but wont blit the fourth.
    Spoiler for whole code if it helps:
    -- Escape The Car
    -- Ported By Cmbeke
    -- Originally By Shawn Tanner
    -- Uses A Modification on TacticalPenguin's Analog Code
    -- 7/13/2009

    p1 = Image.load("Escape the Car\\1.png")
    p2 = Image.load("Escape the Car\\2.png")
    p3 = Image.load("Escape the Car\\3.png")
    p4 = Image.load("Escape the Car\\4.png")
    p5 = Image.load("Escape the Car\\15.png")
    p6 = Image.load("Escape the Car\\14.png")
    p7 = Image.load("Escape the Car\\7.png")
    p8 = Image.load("Escape the Car\\17.png")
    p9 = Image.load("Escape the Car\\11.png")
    p10 = Image.load("Escape the Car\\9.png")

    cursor = {x = 50, y = 100, img = Image.load("cursor.png")}
    smenu = Image.load("submenu.png")
    rmenu = Image.load("menu.png")
    qmenu = Image.load("quitmenu.png" )

    require("colors")

    currentFrame = 0 -- Sets Up Frame Skip
    frameSkip = 1 -- How Many Frames To Skip

    submenu = 0
    menu = 0
    quit = 0
    currentpic = 1
    checkpad = Controls.read()


    function Frame()
    if currentFrame >= frameSkip then
    currentFrame = 0
    end
    currentFrame = currentFrame + 1;
    end

    function analog()
    deadzone = 30
    sensitivity = 40
    anx = pad:analogX()
    any = pad:analogY()
    if math.abs(anx) > deadzone then
    cursor.x = cursor.x + anx/sensitivity
    end
    if math.abs(any) > deadzone then
    cursor.y = cursor.y + any/sensitivity
    end
    if cursor.x <= 0 then
    cursor.x = 0
    end
    if cursor.y <= 0 then
    cursor.y = 0
    end
    if cursor.x >= 480 then
    cursor.x = 480
    end
    if cursor.y >= 272 then
    cursor.y = 272
    end
    if currentFrame == frameSkip then
    screen:blit(cursor.x, cursor.y, cursor.img)
    end
    end

    function paste()
    if currentFrame == frameSkip then
    if currentpic == 1 then
    screen:blit(0,0, p1)
    end
    if currentpic == 2 then
    screen:blit(0,0, p2)
    end
    if currentpic == 3 then
    screen:blit(0,0, p3)
    end
    if currentpic == 4 then
    screen:blit(0,0, p4)
    end
    if currentpic == 5 then
    screen:blit(0,0, p5)
    end
    if currentpic == 6 then
    screen:blit(0,0, p6)
    end
    if currentpic == 7 then
    screen:blit(0,0, p7)
    end
    if currentpic == 8 then
    screen:blit(0,0, p8)
    end
    if currentpic == 9 then
    screen:blit(0,0, p9)
    end
    if currentpic == 10 then
    screen:blit(0,0, p10)
    end

    end -- Frame Skip

    if menu == 0 and quit == 0 then
    if currentpic == 1 then
    if pad:left() and checkpad:left() ~= pad:left() and not pad:select() then
    currentpic = 2
    end
    if pad:right() and checkpad:right() ~= pad:right() and not pad:select() then
    currentpic = 3
    end
    end
    if currentpic == 2 then
    if pad:right() and checkpad:right() ~= pad:right() and not pad:select() then
    currentpic = 1
    end
    if pad:left() and checkpad:left() ~= pad:left() and not pad:select() then
    currentpic = 4
    end
    end
    if currentpic == 3 then
    if pad:left() and checkpad:left() ~= pad:left() and not pad:select() then
    currentpic = 1
    end
    if pad:right() and checkpad:right() ~= pad:right() and not pad:select() then
    currentpic = 4
    end
    end
    if currentpic == 4 then
    if pad:left() and checkpad:left() ~= pad:left() and not pad:select() then
    currentpic = 3
    end
    if pad:right() and checkpad:right() ~= pad:right() and not pad:select() then
    currentpic = 2
    end
    end

    if pad:square() then
    currentpic = 4
    end

    if currentpic == 5 then
    if pad:right() and checkpad:right() ~= pad:right() and not pad:select() then
    currentpic = 1
    end
    if pad:left() and checkpad:left() ~= pad:left() and not pad:select() then
    currentpic = 1
    end
    if pad:up() and checkpad:up() ~= pad:up() and not pad:select() then
    currentpic = 1
    end
    if pad:down() and checkpad:down() ~= pad:down() and not pad:select() then
    currentpic = 1
    end
    end

    if currentpic == 6 then
    if pad:right() and checkpad:right() ~= pad:right() and not pad:select() then
    currentpic = 1
    end
    if pad:left() and checkpad:left() ~= pad:left() and not pad:select() then
    currentpic = 1
    end
    if pad:up() and checkpad:up() ~= pad:up() and not pad:select() then
    currentpic = 1
    end
    if pad:down() and checkpad:down() ~= pad:down() and not pad:select() then
    currentpic = 1
    end
    end

    if currentpic == 7 then
    if pad:right() and checkpad:right() ~= pad:right() and not pad:select() then
    currentpic = 1
    end
    if pad:left() and checkpad:left() ~= pad:left() and not pad:select() then
    currentpic = 1
    end
    if pad:up() and checkpad:up() ~= pad:up() and not pad:select() then
    currentpic = 1
    end
    if pad:down() and checkpad:down() ~= pad:down() and not pad:select() then
    currentpic = 1
    end
    end

    if currentpic == 8 then
    if pad:right() and checkpad:right() ~= pad:right() and not pad:select() then
    currentpic = 1
    end
    if pad:left() and checkpad:left() ~= pad:left() and not pad:select() then
    currentpic = 1
    end
    if pad:up() and checkpad:up() ~= pad:up() and not pad:select() then
    currentpic = 1
    end
    if pad:down() and checkpad:down() ~= pad:down() and not pad:select() then
    currentpic = 1
    end
    end

    if currentpic == 9 then
    if pad:right() and checkpad:right() ~= pad:right() and not pad:select() then
    currentpic = 4
    end
    if pad:left() and checkpad:left() ~= pad:left() and not pad:select() then
    currentpic = 4
    end
    if pad:up() and checkpad:up() ~= pad:up() and not pad:select() then
    currentpic = 4
    end
    if pad:down() and checkpad:down() ~= pad:down() and not pad:select() then
    currentpic = 4
    end
    end

    if currentpic == 10 then
    if pad:right() and checkpad:right() ~= pad:right() and not pad:select() then
    currentpic = 4
    end
    if pad:left() and checkpad:left() ~= pad:left() and not pad:select() then
    currentpic = 4
    end
    if pad:up() and checkpad:up() ~= pad:up() and not pad:select() then
    currentpic = 4
    end
    if pad:down() and checkpad:down() ~= pad:down() and not pad:select() then
    currentpic = 4
    end
    end

    end
    end

    function menuSystem()
    if currentFrame == frameSkip then
    -- Main Menu
    if menu == 1 then
    screen:blit(0,0, rmenu)
    if pad:circle() then
    menu = 0
    end
    end
    -- Submenu
    if submenu == 1 then
    screen:blit(0,176, smenu)
    if pad:circle() then
    submenu = 0
    end
    end
    -- Quit Menu
    if quit == 1 then
    screen:blit(0,0, qmenu)
    if pad:circle() then
    quit = 0
    end
    if pad:triangle() and checkpad:triangle() ~= pad:triangle() then
    System.quit()
    end
    end

    end -- Frame Skip

    -- Buttons
    if pad:l() or pad:r() and menu ~= 1 then
    submenu = 1
    end
    if pad:start() and submenu ~= 1 then
    menu = 1
    end
    if pad:triangle() then
    quit = 1
    end
    end

    function hittesting()
    -- First Frame
    if currentpic == 1 then
    -- Dashboard Compartment
    if cursor.x >= 315 and cursor.x <= 460 and cursor.y >= 140 and cursor.y <= 194 then
    if pad:cross() then
    currentpic = 5
    end
    end
    -- Pedals/Under Stering Wheel
    if cursor.x >= 45 and cursor.x <= 160 and cursor.y >= 200 and cursor.y <= 235 then
    if pad:cross() then
    currentpic = 6
    end
    end
    -- Box Behind the Gears
    if cursor.x >= 201 and cursor.x <= 288 and cursor.y >= 245 and cursor.y <= 272 then
    if pad:cross() then
    currentpic = 7
    end
    end
    -- Dashboard
    if cursor.x >= 80 and cursor.x <= 148.1 and cursor.y >= 145 and cursor.y <= 169 then
    if pad:cross() then
    currentpic = 8
    end
    end
    end-- First Frame

    -- Fourth Frame
    if currentpic == 4 then
    --Ground
    if cursor.x >= 15 and cursor.x <= 475 and cursor.y >= 258 and cursor.y <= 272 then
    if pad:cross() then
    currentpic = 9
    end
    end
    -- Box 2
    if cursor.x >= 215 and cursor.x <= 269 and cursor.y >= 251 and cursor.y <= 255 then
    if pad:cross() then
    currentpic = 10
    end
    end

    end -- Fourth Frame
    end

    function debuger()
    screenrint(0,10, "Cursor.X = "..cursor.x, red)
    screenrint(0,20, "Cursor.Y = "..cursor.y, red)
    if pad:left() and pad:select() then
    cursor.x = cursor.x - .1
    end
    if pad:right() and pad:select() then
    cursor.x = cursor.x + .1
    end
    if pad:down() and pad:select() then
    cursor.y = cursor.y + .1
    end
    if pad:up() and pad:select() then
    cursor.y = cursor.y - .1
    end
    end

    while true do
    pad = Controls.read()
    Frame()
    System.startGu()
    paste()
    menuSystem()
    analog()
    hittesting()
    debuger()
    System.endGu()
    screen.flip()
    System.showFPS()
    checkpad = pad
    end
    ...


 

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 07:52 AM Uhr.

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