Seite 197 von 342 ErsteErste ... 97 147 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 247 297 ... LetzteLetzte
Zeige Ergebnis 5.881 bis 5.910 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; You mean to unencrypt?...

  
  1. #5881
    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

    You mean to unencrypt?



  2. #5882
    Look at my user title :p
    Points: 14.103, Level: 77
    Level completed: 14%, Points required for next Level: 347
    Overall activity: 0%

    Registriert seit
    Feb 2006
    Ort
    Texas
    Beiträge
    1.183
    Points
    14.103
    Level
    77
    Downloads
    0
    Uploads
    0

    Standard

    thats what i meant srry really tired

  3. #5883
    QJ Gamer Blue
    Points: 4.241, Level: 41
    Level completed: 46%, Points required for next Level: 109
    Overall activity: 0%

    Registriert seit
    Jul 2006
    Ort
    Alabama
    Beiträge
    142
    Points
    4.241
    Level
    41
    Downloads
    0
    Uploads
    0

    Standard

    Just keep a spare, unencrypted script.

  4. #5884
    Look at my user title :p
    Points: 14.103, Level: 77
    Level completed: 14%, Points required for next Level: 347
    Overall activity: 0%

    Registriert seit
    Feb 2006
    Ort
    Texas
    Beiträge
    1.183
    Points
    14.103
    Level
    77
    Downloads
    0
    Uploads
    0

    Standard

    yeah i forgot to cause i was tired and just clicked it. now remembered i didnt have an extra

  5. #5885
    QJ Gamer Green
    Points: 11.800, Level: 71
    Level completed: 38%, Points required for next Level: 250
    Overall activity: 0%

    Registriert seit
    Jul 2006
    Ort
    Middle Europe
    Beiträge
    1.281
    Points
    11.800
    Level
    71
    Downloads
    0
    Uploads
    0

    Standard

    why do you encrypt lua codes? o_O

  6. #5886
    Banned for LIFE
    Points: 18.744, Level: 86
    Level completed: 79%, Points required for next Level: 106
    Overall activity: 0%

    Registriert seit
    Oct 2006
    Ort
    East London, England
    Beiträge
    2
    Points
    18.744
    Level
    86
    Downloads
    0
    Uploads
    0

    Standard

    So nobody can copy his hard work. Although i don't encrypt my scripts.

  7. #5887
    QJ Gamer Green
    Points: 6.520, Level: 52
    Level completed: 85%, Points required for next Level: 30
    Overall activity: 0%

    Registriert seit
    Nov 2005
    Ort
    Sweden
    Beiträge
    460
    Points
    6.520
    Level
    52
    Downloads
    0
    Uploads
    0

    Standard

    Zitat Zitat von eldiablov
    So nobody can copy his hard work. Although i don't encrypt my scripts.
    The actual characters within the document also becomes fewer, and LuaPlayer reads the code faster as well.
    Geändert von HaxxBlaster (03-01-2007 um 10:27 AM Uhr)
    [CENTER]Some of my homebrew Applications/Games:
    [URL=http://forums.qj.net/showthread.php?t=47294&page=1&pp=10]Planet Fighter[/URL] | [URL=http://forums.qj.net/showthread.php?p=641672#post641672]Graphic Creator (V2.0)[/URL] | [URL=http://forums.qj.net/showthread.php?p=512717]Fire Pong[/URL] | [B][URL="http://forums.qj.net/f-psp-development-forum-11/t-release-brushes-v20-99207.html#post1430891"][COLOR="Red"][SIZE="3"]Brushes v2.0[/COLOR][/SIZE][/B][/URL] [URL="http://forums.qj.net/f-psp-development-forum-11/t-release-brushes-v20-99207.html"][B][SIZE="2"][COLOR="Black"]Released![/COLOR][/SIZE][/B][/URL]
    [URL="http://haxxblaster.2u.se/"][COLOR="black"][FONT="Arial Black"]www.HaxxBlaster.com[/FONT][/COLOR][/URL]

    [URL="http://forums.qj.net/f-psp-development-forum-11/t-release-brushes-v20-99207.html"][IMG]http://img19.imageshack.us/img19/1346/brushesbannerqz3.png[/IMG][/URL][/CENTER]

  8. #5888
    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

    Zitat Zitat von HaxxBlaster
    The actual characters within the document also becomes fewer, and LuaPlayer reads the code faster as well.
    you're saying that if i encrypt my code that my game will run faster?

  9. #5889
    I'm Baaaack!
    Points: 17.067, Level: 83
    Level completed: 44%, Points required for next Level: 283
    Overall activity: 52,0%

    Registriert seit
    May 2006
    Ort
    Nowhere
    Beiträge
    2.186
    Points
    17.067
    Level
    83
    Downloads
    0
    Uploads
    0

    Standard

    Zitat Zitat von emericaska8r
    you're saying that if i encrypt my code that my game will run faster?
    Yes. It'll save space too.

  10. #5890
    Points: 3.531, Level: 37
    Level completed: 21%, Points required for next Level: 119
    Overall activity: 0%

    Registriert seit
    Feb 2007
    Beiträge
    43
    Points
    3.531
    Level
    37
    Downloads
    0
    Uploads
    0

    Standard

    what do you use to encrypt it?

  11. #5891
    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

    i'm searching for it, i'll let you know when i find it

  12. #5892
    I'm Baaaack!
    Points: 17.067, Level: 83
    Level completed: 44%, Points required for next Level: 283
    Overall activity: 52,0%

    Registriert seit
    May 2006
    Ort
    Nowhere
    Beiträge
    2.186
    Points
    17.067
    Level
    83
    Downloads
    0
    Uploads
    0

    Standard

    The Luac binary.
    Make a new text file. Inside of it write:

    Luac yourscriptname.lua outputname.lua
    pause

    Then rename it to Luac.bat and run it.
    Angehängte Dateien Angehängte Dateien

  13. #5893
    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

    seems like there is a thing called luac which precompiles your code into binary files which will load faster, and protect your code.
    -= Double Post =-
    and XtreamLua Compiler
    Geändert von emericaska8r (03-01-2007 um 02:58 PM Uhr) Grund: Automerged Doublepost

  14. #5894
    I'm Baaaack!
    Points: 17.067, Level: 83
    Level completed: 44%, Points required for next Level: 283
    Overall activity: 52,0%

    Registriert seit
    May 2006
    Ort
    Nowhere
    Beiträge
    2.186
    Points
    17.067
    Level
    83
    Downloads
    0
    Uploads
    0

    Standard

    LuaC is different than XtreamLua Compiler. XtreamLua Compiler is harder to decrypt.

  15. #5895
    Points: 3.531, Level: 37
    Level completed: 21%, Points required for next Level: 119
    Overall activity: 0%

    Registriert seit
    Feb 2007
    Beiträge
    43
    Points
    3.531
    Level
    37
    Downloads
    0
    Uploads
    0

    Standard

    ok i need some more help here i got my animation to work I acutally didn't use animation lib but soulkiller's aniamtion instead :Punk: but i have a scrolling bg and when i move the whole animation comes with me here's my script if anyone wants to give a crack at it



    [code]
    --///////////////// Aquateen Created By : pspaquaforce, Thanks To Evilmana Tutorials\\\\\\\\\\\\\\\\ \\
    --///////////////// Special Thanks : Jason215, soulkiller, Evilmana Forums



    green = Color.new(0,255,0)
    white = Color.new(255,255,255)
    red = Color.new(255,0,0)
    black = Color.new(0,0,0)

    --// Player, Enemy, Ground , bullet

    splash = Image.load("splashScreen. png")
    --OPENING SPLASH SCREEN
    screen:clear()
    screen:blit(0,0,splash)
    screen.flip()
    screen.waitVblankStart(10 0)

    backgroundCache = Image.load("image.png")
    backgroundCache2 = Image.load("image2.png")
    backgroundCache3 = Image.load("image3.png")


    bullet = Image.createEmpty(4,4)
    bullet:clear(red)

    player1 = Image.load("figure.png")

    Player = {}
    Player[1] ={ x = 50, y = 200, gravity = 200, jumpspeed = 10, jumpstate= "ground"}

    enemy1 = Image.load("shake.png") --// enemy image

    Enemy= {}
    Enemy[1] ={x = 400, y = 150, gravity = 200, jumpspeed = 10, jumpstate= "ground"}

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

    Back1 = {} --------first scrolling background ( standard image 480 x 272)
    Back1.x = 0 ----positioned at the start
    Back1.y = 0

    Back1.img = backgroundCache --- first background

    Back2 = {} --------Second scrolling background ( standard image 480 x 272)
    Back2.x = 480 ---- positioned precisely after the first background
    Back2.y = 0

    Back2.img = backgroundCache2 --- second background to scroll after first

    Back3 = {} --------Third scrolling background ( standard image 480 x 272)
    Back3.x = 960 ---- positioned precisely after the second background
    Back3.y = 0
    Back3.img = backgroundCache3 --- second background to scroll after second

    ground = Image.load("ground.png")

    frame1 = Image.load("frame1.png")
    frame2 = Image.load("frame2.png")
    frame3 = Image.load("frame3.png")
    currentFrame = 1 --this represents which frame is displaying
    counter = 0 --this is the frame counter which is used to determine when to change frames

    --// Variable

    oldpad = Controls.read()
    currentBullet = 0
    direction = "right"

    --// Functions

    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
    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 bulletSetup()
    --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[1].x
    BulletInfo[currentBullet].y = Player[1].y + 16
    end
    if direction == "right" then
    BulletInfo[currentBullet].x = Player[1].x + 32
    BulletInfo[currentBullet].y = Player[1].y + 16
    end

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

    function movePlayer()
    pad = Controls.read()
    if pad:left() then
    Player[1].x = Player[1].x - 1.5
    Back1.x = Back1.x + 3 ------ moves the background to scroll in the direction you are going
    Back2.x = Back2.x + 3 ------ moves the background to scroll in the direction you are going
    Back3.x = Back3.x + 3 ------ moves the background to scroll in the direction you are going
    direction = "left"
    end
    if pad:right() then
    Player[1].x = Player[1].x + 1.5
    Back1.x = Back1.x - 3 ------ moves the background to scroll in the direction you are going
    Back2.x = Back2.x - 3 ------ moves the background to scroll in the direction you are going
    Back3.x = Back3.x - 3 ------ moves the background to scroll in the direction you are going
    direction = "right"
    end
    if pad:up() then
    Player[1].y = Player[1].y - 1
    direction = "up"
    end
    if pad:down() then
    Player[1].y = Player[1].y + 1
    direction = "down"
    end
    end

    function chasePlayer()
    stallchase = math.random(2)
    if stallchase == 1 then
    if Enemy[1].x > Player[1].x then
    Enemy[1].x = Enemy[1].x - 1.5
    elseif Enemy[1].x < Player[1].x then
    Enemy[1].x = Enemy[1].x + 2
    end
    end
    end

    function Jump() --// Function to jump

    if pad:cross() and Player[1].jumpstate == "ground" then Player[1].jumpstate = "jumping"
    end
    if Player[1].jumpstate == "jumping" then
    Player[1].jumpspeed = Player[1].jumpspeed - 0.5
    Player[1].gravity = Player[1].gravity - Player[1].jumpspeed
    end

    if Player[1].gravity < 0 then
    Player[1].jumpstate = "falling"
    end

    if Player[1].gravity < 200 and Player[1].jumpstate == "falling" then
    Player[1].gravity = Player[1].gravity + (Player[1].jumpspeed + 3)
    end

    if Player[1].gravity == 200 then
    Player[1].jumpspeed = 10
    Player[1].jumpstate = "ground"
    end

    if Player[1].gravity > 200 then Player[1].gravity = 200
    end

    Player[1].y = Player[1].gravity
    end


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

    counter = counter + 1
    screen:clear()
    if counter > 60 then --if 60 frames have passed
    if currentFrame == 3 then --if we are on the last frame
    currentFrame = 1 --go back to first frame (loops animation)
    else
    currentFrame = currentFrame + 1 --else goto the next frame
    end
    counter = 0 --reset the counter
    end

    if pad:circle() and oldpad:circle() ~= pad:circle() then
    bulletSetup()
    end
    --// Loads Functions
    movePlayer()
    chasePlayer()

    Jump()
    --


    --// blitting Image to screen and text

    screen:blit(Back1.x, Back1.y, Back1.img) --- blits first background to the screen
    screen:blit(Back2.x, Back2.y, Back2.img) --- blits second background to the screen
    screen:blit(Back3.x, Back3.y, Back3.img) --- blits third background to the screen

    screen:blit(Player[1].x, Player[1].y, player1)
    screen:blit(Enemy[1].x, Enemy[1].y, enemy1)
    screen:blit(0,262,ground)

    bulletFire()

    screenrint(10,10,"X: "..Player[1].x.." Y: "..Player[1].y,green)
    screenrint(10,20,"Jumps tate: "..Player[1].jumpstate,green)
    screenrint(400,10,"You Suck",green)
    --
    if currentFrame == 1 then --draw first frame
    screen:blit(370,50,frame1 )
    elseif currentFrame == 2 then --draw second frame
    screen:blit(370,50,frame2 )
    elseif currentFrame == 3 then --draw third frame
    screen:blit(370,50,frame3 )
    end

    screen.waitVblankStart()
    screen.flip()
    end[code]

  16. #5896
    QJ Gamer Blue
    Points: 4.369, Level: 42
    Level completed: 10%, Points required for next Level: 181
    Overall activity: 0%

    Registriert seit
    Feb 2007
    Beiträge
    246
    Points
    4.369
    Level
    42
    Downloads
    0
    Uploads
    0

    Standard

    I'm trying to make a function that will load all the images in the sub directory "tiles" into a table. The code I've put together so far doesn't work, lua player quits with this error message:

    error: tileloader.lua:15 attempt to index global 'files' (a nil value)

    or

    error: tileloader.lua:15 Image.load: error loading image

    it depends on whether or not I use ".tiles/" or "tiles/"

    Code:
    loop1 = true
    loop2 = true
    tilenum = 1
    files = {}
    tiles = {}
    white=Color.new(255,255,255)
    
    
    -- load all images from tiles folder
    function loadtiles(tiles)
    	loop1 = true
    	files = System.listDirectory("tiles/")
    		while loop1 do
    		tiles[tilenum] = Image.load(files[tilenum].name)
    		tilenum = tilenum +1
    		if files[tilenum].name == nil then loop1 = false end
    	end
    end		
    
    loadtiles(tiles)
    
    -- display images one at a time
    loop1 = true
    tilenum = 1
    
    while loop1 do
    	loop2 = true
    	screen:blit (10,10, tiles[tilenum])
    	screen:flip()
    	while loop2 do
    		pad = Controls.read()
    		if pad:start() then loop2=false oldpad = pad end
    	end
    	tilenum = tilenum +1
    	if pad:start() and pad ~= oldpad then loop1 = false end
    
    end
    can anyone tell me what I'm doing wrong?
    Geändert von Merick (03-01-2007 um 04:11 PM Uhr)

  17. #5897
    I love the PS3!!!
    Points: 11.447, Level: 70
    Level completed: 50%, Points required for next Level: 203
    Overall activity: 0%

    Registriert seit
    Nov 2005
    Ort
    Look behind you
    Beiträge
    1.876
    Points
    11.447
    Level
    70
    Downloads
    0
    Uploads
    0

    Standard

    I just had a inquiry

    which is more efficient, doing 3 if statements or using one if and 2 else if?
    [size=-3][color=#fefefe]11[/color][color=white]0[/color][color=#fbfbfb]1[/color][color=#f1f4f6]0[/color][color=#f2f5f8]0[/color][color=#f7f8fa]1[/color][color=#fcfcfc]0[/color][color=#fdfefd]0[/color][color=#fffffe]1[/color][color=#fefefe]1[/color][color=white]1[/color][color=#fefefe]000[/color][color=white]1[/color][color=#fefefe]0[/color][color=white]0[/color][color=#fefefe]1111011[/color][color=white]1[/color][color=#fefefe]1[/color][color=white]101[/color]
    [color=white]1[/color][color=#fffefe]0[/color][color=#cad3e0]0[/color][color=#6f7f9c]1[/color][color=#788eaf]0[/color][color=#98b7d6]0[/color][color=#99c0e1]0[/color][color=#9ac2e2]1[/color][color=#a5c6e2]1[/color][color=#a6c3e2]0[/color][color=#b2bed1]1[/color][color=#dbe2ed]0[/color][color=#f7f9fa]1[/color][color=#fefefd]10110[/color][color=#fefefe]01[/color][color=#fefefd]0[/color][color=#fefefe]1[/color][color=#fefefd]10[/color][color=#fefefe]1[/color][color=white]00100[/color]
    [color=#fefefe]0[/color][color=#f2f6f8]0[/color][color=#566da3]0[/color][color=#8a919d]1[/color][color=#e2e5e4]0[/color][color=#eff2f3]0[/color][color=#eef2f6]1[/color][color=#e8eef3]1[/color][color=#dfe6ee]1[/color][color=#d1dee8]0[/color][color=#c1cddd]1[/color][color=#7997ce]1[/color][color=#8ea4d1]1[/color][color=#ebeeee]0[/color][color=#fdfef9]0[/color][color=#fefffa]1[/color][color=#fefefc]01101011[/color][color=#fefefd]1[/color][color=#fefefe]00[/color][color=white]10[/color][color=#fefefe]1[/color]
    [color=#fefefe]1[/color][color=#dde3ef]0[/color][color=#4866a7]1[/color][color=#b3bbc6]0[/color][color=#fafbf7]1[/color][color=#fefefc]0[/color][color=#f6f7f9]0[/color][color=#a8b6cf]1[/color][color=#6a7c9b]0[/color][color=#6886b2]0[/color][color=#7697c8]0[/color][color=#85a3cd]1[/color][color=#6287c3]1[/color][color=#496eb6]1[/color][color=#98abce]0[/color][color=#dde5e5]1[/color][color=#fcfef4]0[/color][color=#fdfef7]1[/color][color=#fefffa]100[/color][color=#fefefb]00[/color][color=#fefefc]00[/color][color=#fefefd]1[/color][color=#fefefe]1[/color][color=white]0[/color][color=#fefefe]0[/color][color=white]1[/color]
    [color=#fefefd]0[/color][color=#f8fafa]0[/color][color=#a7bce4]1[/color][color=#6887cf]0[/color][color=#9eb0d3]1[/color][color=#e3e9ec]1[/color][color=#bbc4d6]0[/color][color=#405b99]1[/color][color=#848b97]0[/color][color=#c2cace]0[/color][color=#c2cdd7]1[/color][color=#bdcce0]0[/color][color=#94acd4]1[/color][color=#547dc3]1[/color][color=#385ea9]1[/color][color=#496eb1]1[/color][color=#90a7c7]1[/color][color=#dde4e4]1[/color][color=#f6f9ee]1[/color][color=#fcfef3]1[/color][color=#fdfff5]1[/color][color=#fdfef7]1[/color][color=#fdfef8]0[/color][color=#fdfef9]1[/color][color=#fefefa]1[/color][color=#fefffb]1[/color][color=#fefefb]0[/color][color=#fefefc]1[/color][color=#fefefe]11[/color]
    [color=#fefefc]01[/color][color=#fcfdfc]0[/color][color=#e6ecf7]0[/color][color=#9fb5e7]0[/color][color=#6889cf]0[/color][color=#6b86c0]1[/color][color=#415ba1]0[/color][color=#6c82b0]0[/color][color=#d4d9da]0[/color][color=#f4f6ec]0[/color][color=#f8faf1]1[/color][color=#f5f8f3]0[/color][color=#e0e7ec]1[/color][color=#a0b7d8]1[/color][color=#5e82c2]0[/color][color=#2e5fb4]0[/color][color=#4065b0]1[/color][color=#809cc5]1[/color][color=#cdd7d9]1[/color][color=#f7f9e9]0[/color][color=#fafcef]1[/color][color=#fcfef2]1[/color][color=#fdfef5]1[/color][color=#fdfef6]1[/color][color=#fdfef9]0[/color][color=#fefff9]1[/color][color=#fefffa]1[/color][color=#fefefc]10[/color]
    [color=#fefefc]1100[/color][color=#fbfcfc]1[/color][color=#e8eff7]1[/color][color=#a5b8e6]1[/color][color=#5a7cc9]1[/color][color=#3a589d]0[/color][color=#3c5ba2]1[/color][color=#8d9fc1]1[/color][color=#d8deda]0[/color][color=#f4f7e8]0[/color][color=#f5f8ec]1[/color][color=#f1f5ea]0[/color][color=#dee5e4]1[/color][color=#b1c2d5]0[/color][color=#6b8dc7]1[/color][color=#416dba]1[/color][color=#3965b2]0[/color][color=#6c88b8]1[/color][color=#b5c3cd]0[/color][color=#e4e8df]1[/color][color=#f7f8e8]0[/color][color=#fbfdef]1[/color][color=#fcfef4]0[/color][color=#fdfff7]1[/color][color=#fefffa]0[/color][color=#fefefb]0[/color][color=#fefefc]1[/color]
    [color=#fefffb]1[/color][color=#fefefb]1[/color][color=#fefefc]0[/color][color=#fefffb]10[/color][color=#fdfefa]1[/color][color=#f9fbf9]0[/color][color=#dce4f1]1[/color][color=#94aada]1[/color][color=#4567b4]0[/color][color=#2c509f]0[/color][color=#4c6bac]0[/color][color=#a0adc3]1[/color][color=#e3e6db]0[/color][color=#f0f2e2]1[/color][color=#f0f3e4]0[/color][color=#ecf0e3]0[/color][color=#dde1dd]0[/color][color=#b1bfd1]0[/color][color=#7893bf]0[/color][color=#416fb7]0[/color][color=#3c66ad]0[/color][color=#6181b8]1[/color][color=#a3b2c8]1[/color][color=#dfe4de]1[/color][color=#f1f3e6]0[/color][color=#fafbf0]0[/color][color=#fcfdf6]1[/color][color=#fdfff8]1[/color][color=#fefffa]0[/color]
    [color=#fefffa]10[/color][color=#fefefa]1[/color][color=#fefffa]1[/color][color=#fefff9]11[/color][color=#fdfef8]1[/color][color=#fcfdf4]0[/color][color=#f5f7f3]0[/color][color=#d6dee9]1[/color][color=#809ad5]0[/color][color=#3a5cad]1[/color][color=#264a9f]1[/color][color=#4e6aad]1[/color][color=#a8b3c5]1[/color][color=#e2e4d5]1[/color][color=#ebecda]1[/color][color=#edeee0]0[/color][color=#e9ebde]0[/color][color=#dee1db]1[/color][color=#bfc7cd]1[/color][color=#869ec2]1[/color][color=#5479ba]1[/color][color=#3665b4]1[/color][color=#466aaf]0[/color][color=#7f95b9]1[/color][color=#c5ccd0]1[/color][color=#f2f3e6]0[/color][color=#f9faef]1[/color][color=#fcfef4]0[/color]
    [color=#fdfef7]10110[/color][color=#fdfef5]1[/color][color=#fdfdf2]1[/color][color=#fbfdf1]0[/color][color=#fbfcf0]0[/color][color=#f6f8ec]0[/color][color=#eaece8]0[/color][color=#c0cbdc]1[/color][color=#6e88c5]1[/color][color=#3657ab]0[/color][color=#2d4ea1]1[/color][color=#5b73ac]1[/color][color=#b1b9c1]1[/color][color=#dbdccf]0[/color][color=#e5e6d4]0[/color][color=#e6e7d7]0[/color][color=#e4e5da]0[/color][color=#d9ddd5]1[/color][color=#c1caca]0[/color][color=#99a9be]1[/color][color=#6584b9]1[/color][color=#4369b1]0[/color][color=#3f5fa1]0[/color][color=#7586a6]0[/color][color=#dcddd0]1[/color][color=#f4f4e7]1[/color]
    [color=#fcfdf1]01[/color][color=#fcfcf0]1[/color][color=#fcfcef]1[/color][color=#fcfcf0]1[/color][color=#fcfcef]0[/color][color=#fbfced]0[/color][color=#f9fbeb]1[/color][color=#f9faea]1[/color][color=#f7f8e7]0[/color][color=#f3f4e6]1[/color][color=#eeeee2]1[/color][color=#dbdfdb]0[/color][color=#a4b1ca]1[/color][color=#5670b4]1[/color][color=#284ca4]1[/color][color=#2e4e9a]0[/color][color=#6d80aa]1[/color][color=#bcc0bb]0[/color][color=#d9dbc9]1[/color][color=#dfe0ce]0[/color][color=#e2e3d2]0[/color][color=#dfe1d2]1[/color][color=#d7dbd0]1[/color][color=#c4cbc9]1[/color][color=#96a2b6]0[/color][color=#3c558e]0[/color][color=#56637f]0[/color][color=#d0d2c2]0[/color][color=#eae9db]0[/color]
    [color=#fafbec]1[/color][color=#f9faea]1000[/color][color=#f8f8e8]0[/color][color=#f7f7e6]1[/color][color=#f5f7e5]0[/color][color=#f5f5e3]0[/color][color=#f3f3e1]1[/color][color=#f1f1dd]0[/color][color=#eeeedc]0[/color][color=#ececda]0[/color][color=#e3e4d4]0[/color][color=#ced0c9]0[/color][color=#8e9db9]1[/color][color=#4766ac]0[/color][color=#234799]0[/color][color=#2e4c96]0[/color][color=#727d93]1[/color][color=#c1c2b1]0[/color][color=#d0d2c0]0[/color][color=#c1c6c1]1[/color][color=#9ba3b1]0[/color][color=#677591]0[/color][color=#415179]1[/color][color=#515d75]1[/color][color=#9fa29b]0[/color][color=#dbdacc]0[/color][color=#eceadb]0[/color]
    [color=#f6f5e5]10[/color][color=#f5f4e4]1[/color][color=#f5f5e3]01[/color][color=#f3f3e1]0[/color][color=#f3f2de]1[/color][color=#f2f1e0]0[/color][color=#f0efdc]0[/color][color=#efeed9]0[/color][color=#edecd8]0[/color][color=#ebebd6]1[/color][color=#e8e8d2]1[/color][color=#e3e2cd]0[/color][color=#e0dfcb]1[/color][color=#d6d6c6]1[/color][color=#b7bcbf]0[/color][color=#7a8cb0]1[/color][color=#4564a7]0[/color][color=#354d81]1[/color][color=#616b7f]0[/color][color=#57657f]1[/color][color=#445371]1[/color][color=#4f586b]1[/color][color=#6f7478]0[/color][color=#999b93]0[/color][color=#bdbeb0]1[/color][color=#d7d6c6]0[/color][color=#e5e3d3]1[/color][color=#eae9d8]0[/color]
    [color=#f1f0dd]0[/color][color=#f1efdc]0[/color][color=#f1f0e0]1[/color][color=#f0efdc]0[/color][color=#f0f0db]1[/color][color=#f0efd9]1[/color][color=#eeedd8]1[/color][color=#ededd7]1[/color][color=#ebebd4]0[/color][color=#eae9d3]0[/color][color=#e8e7d2]1[/color][color=#e6e6cf]0[/color][color=#e4e4cc]1[/color][color=#e2e2ca]1[/color][color=#e0dfca]0[/color][color=#dddcc6]0[/color][color=#d7d8c3]0[/color][color=#cdcfbd]1[/color][color=#adb1ac]1[/color][color=#868f95]1[/color][color=#777e7f]1[/color][color=#82867f]1[/color][color=#9d9e8f]1[/color][color=#b7b6a2]0[/color][color=#c6c6b0]1[/color][color=#d0d0ba]1[/color][color=#d7d6c3]0[/color][color=#dddcc9]0[/color][color=#e2e1ce]1[/color][color=#e5e4d1]0
    [/color][/size]
    [SIZE=1]a paper clip made by thekon[/SIZE]

  18. #5898
    I'm Baaaack!
    Points: 17.067, Level: 83
    Level completed: 44%, Points required for next Level: 283
    Overall activity: 52,0%

    Registriert seit
    May 2006
    Ort
    Nowhere
    Beiträge
    2.186
    Points
    17.067
    Level
    83
    Downloads
    0
    Uploads
    0

    Standard

    Zitat Zitat von dracule
    I just had a inquiry

    which is more efficient, doing 3 if statements or using one if and 2 else if?
    I would think they would be exactly the same. If not, it can't make that much of a difference.

  19. #5899
    Points: 3.531, Level: 37
    Level completed: 21%, Points required for next Level: 119
    Overall activity: 0%

    Registriert seit
    Feb 2007
    Beiträge
    43
    Points
    3.531
    Level
    37
    Downloads
    0
    Uploads
    0

    Standard

    I like the "if" statment its fun and understandable
    example "if Homo.x == 69.x then
    Gay = true

  20. #5900
    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

    Dont use Gay on these forums.
    Some people find it offensive.

  21. #5901
    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 dracule
    I just had a inquiry

    which is more efficient, doing 3 if statements or using one if and 2 else if?
    the second one. and it does make a big difference. suppose you did this:
    Code:
    if x == 5 then
    -- do whatever --
    end
    if x == 6 then
    -- do whatever -- 
    end
    if x == 7 then
    -- do whatever -- 
    end
    when you ran the script, the program would first check if x was 5. suppose it was. then the code that is inside executes. BUT, after the code is done, the computer AGAIN checks if x is 6 or 7, when it has already matched 5. thus, it wastes some time. this can make a huge difference in programs.

    NOW, suppose you did this:

    Code:
    if x == 5 then
    -- do whatever --
    elseif x == 6 then
    -- do whatever -- 
    elseif x == 7 then
    -- do whatever -- 
    end
    NOW, the compuet again checks if x is 5. suppose it is again. NOW, the code inside executes. after the code has been completed, the program sees the else if and IGNORES the other two if statements, because it knows that a match was made. thus, it saves some time.
    --------------------------------------------------------------------------------------

  22. #5902
    Points: 3.531, Level: 37
    Level completed: 21%, Points required for next Level: 119
    Overall activity: 0%

    Registriert seit
    Feb 2007
    Beiträge
    43
    Points
    3.531
    Level
    37
    Downloads
    0
    Uploads
    0

    Standard

    Dont use Gay on these forums.
    Some people find it offensive.
    how about saying Homosexuals or lezibions that is the proper way to call them. Gay is just a slang term for the meaning homosexual
    I don't think they would find it that offensive, unless your affended by it

  23. #5903
    QJ Gamer Blue
    Points: 7.014, Level: 55
    Level completed: 32%, Points required for next Level: 136
    Overall activity: 0%

    Registriert seit
    Jan 2007
    Ort
    U.S.
    Beiträge
    405
    Points
    7.014
    Level
    55
    Downloads
    0
    Uploads
    0

    Standard

    Lezibions..hmm interesting. Sounds like a relative of the lion. JK.

  24. #5904
    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 Merick
    I'm trying to make a function that will load all the images in the sub directory "tiles" into a table. The code I've put together so far doesn't work, lua player quits with this error message:

    error: tileloader.lua:15 attempt to index global 'files' (a nil value)

    or

    error: tileloader.lua:15 Image.load: error loading image

    it depends on whether or not I use ".tiles/" or "tiles/"

    Code:
    loop1 = true
    loop2 = true
    tilenum = 1
    files = {}
    tiles = {}
    white=Color.new(255,255,255)
    
    
    -- load all images from tiles folder
    function loadtiles(tiles)
    	loop1 = true
    	files = System.listDirectory("tiles/")
    		while loop1 do
    		tiles[tilenum] = Image.load(files[tilenum].name)
    		tilenum = tilenum +1
    		if files[tilenum].name == nil then loop1 = false end
    	end
    end		
    
    loadtiles(tiles)
    
    -- display images one at a time
    loop1 = true
    tilenum = 1
    
    while loop1 do
    	loop2 = true
    	screen:blit (10,10, tiles[tilenum])
    	screen:flip()
    	while loop2 do
    		pad = Controls.read()
    		if pad:start() then loop2=false oldpad = pad end
    	end
    	tilenum = tilenum +1
    	if pad:start() and pad ~= oldpad then loop1 = false end
    
    end
    can anyone tell me what I'm doing wrong?
    Code:
    imagetable = {}
    
    tiledir = System.listDirectory("./
    tiles")
    
    for i = 3, table.getn(tiledir) do
    imagetable[i-2] = Image.load("./tiles/"..tiledir[i].name)
    end
    Try something like that. If you need to know why its for i = 3 and imagetable[i-2] its because listdirectory tables also contain two extra items, . and ..
    That'll load every image in the directory into the table.

  25. #5905
    QJ Gamer Blue
    Points: 4.369, Level: 42
    Level completed: 10%, Points required for next Level: 181
    Overall activity: 0%

    Registriert seit
    Feb 2007
    Beiträge
    246
    Points
    4.369
    Level
    42
    Downloads
    0
    Uploads
    0

    Standard

    Thanks a lot, that fixed it right up! Now I get get to work on the rest of the program.

  26. #5906
    Points: 3.531, Level: 37
    Level completed: 21%, Points required for next Level: 119
    Overall activity: 0%

    Registriert seit
    Feb 2007
    Beiträge
    43
    Points
    3.531
    Level
    37
    Downloads
    0
    Uploads
    0

    Standard

    any idea about mine
    Geändert von pspaquaforce (03-01-2007 um 06:56 PM Uhr)

  27. #5907
    QJ Gamer Blue
    Points: 4.241, Level: 41
    Level completed: 46%, Points required for next Level: 109
    Overall activity: 0%

    Registriert seit
    Jul 2006
    Ort
    Alabama
    Beiträge
    142
    Points
    4.241
    Level
    41
    Downloads
    0
    Uploads
    0

    Standard

    I'll post the code I made for you a couple of days ago. It has notes (mine have !!! before and after), and it improves blitting, too (but it could still be better).
    Spoiler for script:
    Code:
    --///////////////// Aquateen Created By : pspfreak101, Thanks To Evilmana Tutorials\\\\\\\\\\\\\\\\\\
    --///////////////// Special Thanks : Jason215, Evilmana Forums
    
    
    
    green = Color.new(0,255,0)
    white = Color.new(255,255,255)
    red = Color.new(255,0,0)
    black = Color.new(0,0,0)
    
    --// Player, Enemy, Ground , bullet
    backgroundCache = Image.load("image.png")
    backgroundCache2 = Image.load("image2.png")
    backgroundCache3 = Image.load("image3.png")
    
    
    bullet = Image.createEmpty(4,4)
    bullet:clear(green)
    
    player1 = Image.load("figure.png")
    
    Player = {}
    Player[1] ={ x = 50, y = 200, gravity = 200, jumpspeed = 10, jumpstate= "ground"}
    
    enemy1 = Image.load("shake.png") --// enemy image
    
    Enemy= {}
    Enemy[1] ={x = 300, y = 150, gravity = 200, jumpspeed = 10, jumpstate= "ground"}
    
    BulletInfo = {}
    for a = 1,5 do
    BulletInfo[a] = { pic = bullet , firing = false, direction = "right", x = Player[1].x + 32,
    y = Player[1].y + 16 }
    end
    
    Back1 = {} --------first scrolling background ( standard image 480 x 272)
    Back1.x = 0 ----positioned at the start 
    Back1.y = 0
    
    Back1.img = backgroundCache --- first background
    	
    Back2 = {}  --------Second scrolling background ( standard image 480 x 272)
    Back2.x = 480 ---- positioned precisely after the first background
    Back2.y = 0
    	
    Back2.img = backgroundCache2 --- second background to scroll after first
    	
    Back3 = {}  --------Third scrolling background ( standard image 480 x 272)
    Back3.x = 960 ---- positioned precisely after the second background	
    Back3.y = 0
    Back3.img = backgroundCache3 --- second background to scroll after second
    
    ground = Image.createEmpty(480,14)
    ground:clear(green)
    
    
    --// Variable
    
    oldpad = Controls.read()
    currentBullet = 0
    direction = "right"
    
    --// Functions
    
    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
    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 bulletSetup()
    --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[1].x
    BulletInfo[currentBullet].y = Player[1].y + 16
    end
    if direction == "right" then
    BulletInfo[currentBullet].x = Player[1].x + 32
    BulletInfo[currentBullet].y = Player[1].y + 16
    end
    BulletInfo[currentBullet].direction = direction
    BulletInfo[currentBullet].firing = true
    end
    
    function movePlayer()
    if pad:left() then
    Back1.x = Back1.x + 1.5 ------ moves the background to scroll in the !!!opposite!!! direction you are going
    Back2.x = Back2.x + 1.5 ------ moves the background to scroll in the !!!opposite!!! direction you are going
    Back3.x = Back3.x + 1.5 ------ moves the background to scroll in the !!!opposite!!! direction you are going
    direction = "left"
    if Player[1].x >= 70 then -------!!!only if x is more than or = to 70 do you want to move, so you don't go offscreen. Change 70 to 150 or 0 and see what happens!!!
    Player[1].x = Player[1].x - 1.5
    end     -------- !!!END the if pad left part
    end     -------- !!! now END the if x >= 70 part, so it'll only check player[1].x if pad is left, too !!!
    if pad:right() then
    Back1.x = Back1.x - 1.5 ------ moves the background to scroll in the !!!opposite!!! direction you are going
    Back2.x = Back2.x - 1.5 ------ moves the background to scroll in the !!!opposite!!! direction you are going
    Back3.x = Back3.x - 1.5 ------ moves the background to scroll in the !!!opposite!!! direction you are going
    direction = "right"
    if Player[1].x <= 300 then  -------!!!only if x is less than or = to 300 do you want to move, so you don't go offscreen. Change 300 to 450 or 100 and see what happens!!!
    Player[1].x = Player[1].x + 1.5
    end      -------- !!!END the if pad left part
    end     -------- !!! now END the if x <= 300 part, so it'll only check player[1].x if pad is right, too !!!
    if pad:up() then
    Player[1].y = Player[1].y - 1.5
    direction = "up"
    end
    if pad:down() then
    Player[1].y = Player[1].y + 1.5
    direction = "down"
    end
    end
    
    function chasePlayer() 
    stallchase = math.random(2) 
    if stallchase == 1 then 
    if Enemy[1].x > Player[1].x then
    Enemy[1].x = Enemy[1].x - 1
    elseif Enemy[1].x < Player[1].x then
    Enemy[1].x = Enemy[1].x + 1.5
    end
    end
    end
    
    function Jump() --// Function to jump
    
    if pad:cross() and Player[1].jumpstate == "ground" then Player[1].jumpstate = "jumping"
    end
    if Player[1].jumpstate == "jumping" then
    Player[1].jumpspeed = Player[1].jumpspeed - 0.5
    Player[1].gravity = Player[1].gravity - Player[1].jumpspeed
    end
    
    if Player[1].gravity < 0 then
    Player[1].jumpstate = "falling"
    end
    
    if Player[1].gravity < 200 and Player[1].jumpstate == "falling" then
    Player[1].gravity = Player[1].gravity + (Player[1].jumpspeed + 3)
    end
    
    if Player[1].gravity == 200 then
    Player[1].jumpspeed = 10
    Player[1].jumpstate = "ground"
    end
    
    if Player[1].gravity > 200 then Player[1].gravity = 200
    end
    
    Player[1].y = Player[1].gravity
    end
    
    
    while true do
    pad = Controls.read()
    screen:clear()
    
    
    
    if pad:circle() and oldpad:circle() ~= pad:circle() then
    bulletSetup()
    end
    --// Loads Functions
    movePlayer()
    chasePlayer()
    Jump()
    --
    
    --// blitting Image to screen and text !!!first is the bottom layer, last is the top layer!!!
    if Back1.x  <= 480 and Back1.x >= -480 then   ----!!!if it should be visible, blit it, otherwise you're blitting stuff offscreen and slowing down the game!!!
    screen:blit(Back1.x, Back1.y, Back1.img) --- blits first background to the screen
    end
    if Back2.x  <= 480 and Back2.x >= -480 then  ----!!!if it should be visible, blit it, otherwise you're blitting stuff offscreen and slowing down the game!!!
    screen:blit(Back2.x, Back2.y, Back2.img) --- blits second background to the screen
    end
    if Back3.x  <= 480 and Back3.x >= -480 then  ----!!!if it should be visible, blit it, otherwise you're blitting stuff offscreen and slowing down the game!!!
    screen:blit(Back3.x, Back3.y, Back3.img) --- blits third background to the screen
    end
    
    bulletFire()   ----!!!Blits bullets after background, but before player,enemy,text and ground-switch it up however you like !!!
    
    screen:blit(Player[1].x, Player[1].y, player1)
    screen:blit(Enemy[1].x, Enemy[1].y, enemy1)
    screen:blit(0,262,ground)
    
    
    
    screen:print(10,10,"X: "..Player[1].x.." Y: "..Player[1].y,green)
    screen:print(10,20,"Jumpstate: "..Player[1].jumpstate,green)
    screen:print(400,10,"You Suck",green)
    --
    
    
    screen.waitVblankStart()
    screen.flip()
    end


    EDIT:
    I have a question:
    Can someone send me a copy of Wedge Racer? I can't seem to download it, and I need the source as an example.
    EDIT Again:
    Nevermind. After six attempts on dial-up, I got it.
    Geändert von Aphonia (03-01-2007 um 09:54 PM Uhr)

  28. #5908
    QJ Gamer Blue
    Points: 4.369, Level: 42
    Level completed: 10%, Points required for next Level: 181
    Overall activity: 0%

    Registriert seit
    Feb 2007
    Beiträge
    246
    Points
    4.369
    Level
    42
    Downloads
    0
    Uploads
    0

    Standard

    hmm, I'm having some trouble with tables in tables. In my tile loader, how would I make my "tiles" into a two-part table, one part with the image and the second part with the filename of the image?

    *edit*

    I think I've got it worked out now
    Geändert von Merick (03-02-2007 um 11:42 AM Uhr)

  29. #5909
    Points: 3.531, Level: 37
    Level completed: 21%, Points required for next Level: 119
    Overall activity: 0%

    Registriert seit
    Feb 2007
    Beiträge
    43
    Points
    3.531
    Level
    37
    Downloads
    0
    Uploads
    0

    Standard

    thanks aphonia but you still didn't solve my problem. I wanted the animation to stay in one place instead of it moving with me. But thanls for fixing of some my errors

  30. #5910
    Banned for LIFE
    Points: 18.744, Level: 86
    Level completed: 79%, Points required for next Level: 106
    Overall activity: 0%

    Registriert seit
    Oct 2006
    Ort
    East London, England
    Beiträge
    2
    Points
    18.744
    Level
    86
    Downloads
    0
    Uploads
    0

    Standard

    Use animlib to make it easier.


 

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 09:01 PM Uhr.

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