Seite 337 von 342 ErsteErste ... 237 287 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 LetzteLetzte
Zeige Ergebnis 10.081 bis 10.110 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; no i understand the workings of the browser I just was overlooking one small variable(Which I tend to do a ...

  
  1. #10081
    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 i understand the workings of the browser I just was overlooking one small variable(Which I tend to do a lot too) but I figured it out and its all good now.



  2. #10082
    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 2D & Isometric Tile Based Map

    Hi, i guess this should not be rough to fix..
    I'm trying to make a 2D Isometric map using tiles.

    Here are a kinda map i'm trying to reproduce using tiles.



    Now here is the code.Assume i'm using two different tiles, but they are both
    40x20 pixels sized.

    Code:
    --loading tiles
    tile={}
    for i=1,2 do tile[i]=Image.load("./"..i..".png") end
    
    --This matrix represents the world
    map={
    {1,1,1,1},
    {1,1,1,1},
    {2,1,1,2},
    {2,2,2,1},
    {2,2,2,1},
    {2,2,2,1}}
    
    --[[this draws the map.I've considered that for odd index entries in the map table , tiles are blitted correctly.But for even index entries tiles are blitted shifted to the right of 40/2 pixels and shifted up of 20/2 pixels]]
    
    function drawmap(matrix)
    local X=tile[1]:width()
    local Y=tile[1]:height()
    	for j=1,#matrix do
    		for i=1,#matrix[1] do
    		if (j%2)==1 then screen:blit((X)*(i),(j)*Y,tile[matrix[j][i]])
    		elseif (j%2)==0 then screen:blit(X*i+X/2,Y*j-(Y/2),tile[matrix[j][i]])
    		end
    		end
    	end
    end
    
    while true do
    screen:clear()
    drawmap(map)
    screen.waitVblankStart()
    screen.flip()
    end
    Here is is the result, very far from my goal..

    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.

  3. #10083
    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

    in your second loop you need to change the #matrix[1] to #matrix[j] but that wont make a difference to how it displays, ill take a look now for you
    ------ 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).

  4. #10084
    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

    Zitat Zitat von FaT3oYCG Beitrag anzeigen
    in your second loop you need to change the #matrix[1] to #matrix[j] but that wont make a difference to how it displays, ill take a look now for you
    that won't affect the code, just because basically all tables in the matrix table have the same number of indexes.

    Alright, just have a look at it.Thanks in advance.
    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.

  5. #10085
    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

    ok im looking now and i said the same as you but your code would be neater if it was a j but nvm it doesnt matter.

    the tiles that you are using seem to be from a perspective i tried to duplicate them but it doesnt look right, could you post the two image files so i can use them with the code please, thanks
    ------ 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. #10086
    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

    Any pics, with colored lozenges should fit nicely.But just take these ones.
    Angehängte Grafiken Angehängte Grafiken    
    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.

  7. #10087
    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

    this works like you want it to but i think it might need some tweaking

    Code:
    function drawmap(matrix)
    	local X = tile[1]:width()
    	local Y = tile[1]:height()
    
    	for i = 1, #matrix do
    		for j = 1, #matrix[i] do
    			if (i % 2) == 1 then
    				screen:blit((X * j), (Y * i) - (Y * math.ceil(i / 2)), tile[matrix[i][j]])
    			elseif (i % 2) == 0 then
    				screen:blit((X * j) + (X / 2), ((Y * i) - (Y / 2)) - (Y * math.ceil(i / 2)), tile[matrix[i][j]])
    			end
    		end
    	end
    end
    ------ 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. #10088
    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

    Yep it works.I can see my own error.Thanks mate.
    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.

  9. #10089
    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

    i'm trying to make a script to allow me to cycle through some images, and it skips my fourth image. I think that it is doing the 4 image but as soon is it cycles to the fourth one it then goes back to the second or third as if you have pressed a button on the dpad. Is there any way to stop this?
    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 = 2
    end
    if pad:right() and checkpad:right() ~= pad:right() and not pad:select() then
    currentpic = 3
    end
    end
    
    if pad:square() then
    currentpic = 4
    end
    ...

  10. #10090
    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'd rather propose you to modify a bit your code.It would work nicer if you use tables and a lot of iteration to cycle through your images.

    Assuming you have four images to cycle through using left & right keys, and they are named pic1.png, pic2.png, pic3.png and pic4.png

    Code:
    --this table will store pictures
    image = {}
    
    --using a for loop to load once all images
    for i=1,4 do image[i]=Image.load("./pic"..i..".png") end
    
    --this var will take values betwen 1 and 4, and will be used to display a specific image.
    local currentImage=1
        
    --here is the main function: x & y are where images should be bltted on the screen, and Pic is a table containing images
    function cycle(x,y,Pic)
        if key:left() and not oldkey:left() then
            if currentImage-1 >= 1 then currentImage=currentImage-1
            else currentImage=1 
            end
        end
        if key:right() and not oldkey:right() then
            if currentImage+1 <= #Pic then currentImage=currentImage+1
            else currentImage=#Pic 
            end
        end
        screen:blit(x,y,Pic[currentImage])
    end
    
    oldkey=Controls.read()
    
    --the main loop
    while true do
    screen:clear()
    key=Controls.read()
    
    --Using the previous functio to iterate over image table.
    cycle(10,100,image)
    
    oldkey=key
    screen.waitVblankStart()
    screen.flip()
    end
    I guess this fits for you.
    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. #10091
    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

    Now back with another matter,

    Now i'm using 9 tiles.The goal is the same, draw an isometric 2D map with tiles.
    Tiles are 65 by 33 pixels.

    Here is the current rendering:



    Just nice.As you can see, when i try this on my Laptop, the framerate goes up to 200 fps...
    The matter comes when i try it on a PSP.The scrolling is very very slow.Any idea ?


    Code:
    --loading tiles
    math.randomseed(os.time())
    tile={}
    for i=1,9 do tile[i]=Image.load("./G150000"..i..".png") end
    
    ---Creates Map
    function createMap(X,Y)
    	for i=1,X,1 do
    	map[i]={}
    		for j=1,Y do
    		map[i][j]=math.random(1,9)
    		end
    	end
    end
    
    --Stores the map generated in a text file
    function mapsave(mat)
    file=io.open("map.txt","w")
    file:write("map={\n")
     for i=1,#mat do
     file:write("{")
    	for j=1,#mat[i] do 
    		if j ~= #mat[i] then file:write(mat[i][j]..",")
    		else file:write(mat[i][j].."},\n")
    		end	
    	end
    
     end
     file:write("}")
     file:close()
    end
    
    --This Thread Draws the map.It requires some global variables MapX & MapY which are Camera coordinates 
    --Note: all tiles are NOT blitted on the same time.Only those which should be on screen are rendered.
    function draw()
    local X = tile[1]:width()-2
    local Y = tile[1]:height()-2
    
    	for i = 1, #map do
    		for j = 1, #map[i] do
    			if (i % 2) == 1 then
    				if mapX <= (X*j)+X and mapX+480 >= (X*j) and mapY <= (Y*i)+Y-(Y*math.ceil(i/2)) and mapY+272 >= (Y*i)-(Y*math.ceil(i/2)) then screen:blit(-mapX+(X * j), -mapY+(Y * i) - (Y * math.ceil(i / 2)), tile[map[i][j]]) end 
    			elseif (i % 2) == 0 then
    				if mapX <= (X*j)+X+(X/2) and mapX+480 >= (X*j)+(X/2) and mapY <= ((Y * i)+Y - (Y / 2)) - (Y * math.ceil(i / 2)) and mapY+272 >= ((Y * i) - (Y / 2)) - (Y * math.ceil(i / 2)) then screen:blit(-mapX+(X * j) + (X / 2), -mapY+((Y * i) - (Y / 2)) - (Y * math.ceil(i / 2)), tile[map[i][j]]) end
    			end
    		end
    	end
    end
    
    --This function will always create the Drawing thread whenever it dies.
    drawmap=coroutine.create(draw)
    function checkstate(co)
    	if type(co) == "thread"  then
    		if coroutine.status(co) == "dead" or coroutine.status(co)== "suspended" then 
    		drawmap = coroutine.create(draw)
    		coroutine.resume(drawmap)
    		end
    	end
    end
    
    map={}
    createMap(100,50)
    mapsave(map)
    mapX,mapY=100,50
    local fps=Timer.new()
    
    while true do
    screen:clear()
    pad=Controls.read()
    fps:reset()
    fps:start()
    local scroll=10
    if pad:up() then mapY = mapY-scroll end
    if pad:down() then mapY = mapY+scroll end
    if pad:left() then mapX = mapX-scroll end
    if pad:right() then mapX=mapX+scroll end
    
    
     
    
    checkstate(drawmap)
    
    screen:print(10,260, "FPS = "..math.floor(1000/fps:time()), Color.new(255,255,255))
    screen.waitVblankStart()
    screen.flip()
    end
    I've attached a zip file containing the code & pics.Thanks for trying it.
    Angehängte Dateien Angehängte Dateien
    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.

  12. #10092
    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

    it didnt really work, part of that was my fault i had my pics like this:
    ....1
    .2.....3
    ....4
    all i had to do was rename them to this
    ....1
    .4.....2
    ....3
    and it worked perfectly thank you very much
    ...

  13. #10093
    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 seanpaul223 Beitrag anzeigen
    <snip>

    I've attached a zip file containing the code & pics.Thanks for trying it.
    ill take a look for you, maybe you can search into programming techniques, it helps when you are coding because looking at your code im sure i can improve it quite a lot quite quickly by doing something simple, when i post it up you can see and understand.
    ------ 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).

  14. #10094
    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 flggt Beitrag anzeigen
    ill look at it for ya, but maybe you should learn how to code first cuz sometimes it helps ALOT if u no how to code
    directed to anyone but flggt

    Who is this guy?
    ------ 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. #10095
    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 seanpaul223 Beitrag anzeigen
    <snip>

    I've attached a zip file containing the code & pics.Thanks for trying it.
    ok sorry i didnt reply, i did actually fix this but i cant find where i put it on my hard drive, all i did was clean up the code a little and make the display of the tiles a function, then the displaying of the tiles only needs to be called when scroll changes / a button is pressed that would effect it.

    I hope you can replicate what i did because i just cant find where i put it as i was using lua player for windows to test it and then just ran it with usbhost on the psp.

    anyway, oh and on a side note your FPS function is not FPS it is FPL (Frames Per Loop), if you want an FPS function you would need a timer that calculates the time that it took since the timer was last reset in the space of a second
    ------ 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).

  16. #10096
    Developer
    Points: 13.989, Level: 76
    Level completed: 85%, Points required for next Level: 61
    Overall activity: 0%
    Achievements:
    First 1000 Experience Points

    Registriert seit
    Nov 2008
    Beiträge
    71
    Points
    13.989
    Level
    76
    Downloads
    0
    Uploads
    0

    Standard

    hey i'm having a problem with the Font.load() function in LPHMv2.
    i tried loading all of my fonts but it justs freezes when i start the player.
    for ex.

    font = Font.load("ms0:/font/vm.ttf",49)

    but it doesn't work

    i was wondering if i had to input the number as kb or bytes?

    because i've tried both, and it still freezes.

  17. #10097
    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 think you have read the doc if you didn't and if it is included.The way you have to use this func should be explained there.
    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.

  18. #10098
    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

    isnt the number the size? try putting 10 and see what happens, trying to lad the font at size 49 probably would mke it freeze as it would use all of the memory.
    ------ 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).

  19. #10099
    QJ Gamer Green
    Points: 5.875, Level: 49
    Level completed: 63%, Points required for next Level: 75
    Overall activity: 0%

    Registriert seit
    Jul 2008
    Ort
    In your pocket.
    Beiträge
    192
    Points
    5.875
    Level
    49
    My Mood
    Angelic
    Downloads
    0
    Uploads
    0

    Standard

    You really don't need the number, leaving it out will put it at the default, which I think is 10.
    AIM: Digikid91 | PSN: Digikid13 | GaiaOnline: Digikid13

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

    fonts are always powers of 2.....
    49 != power of 2
    40 == and 48 == power of 2

  21. #10101
    QJ Gamer Green
    Points: 3.008, Level: 33
    Level completed: 72%, Points required for next Level: 42
    Overall activity: 0%

    Registriert seit
    May 2008
    Beiträge
    96
    Points
    3.008
    Level
    33
    Downloads
    0
    Uploads
    0

    Standard

    Can someone tell me how to start tables in PGE?

  22. #10102
    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

    tables = lua, pge =api.

    table = {}

  23. #10103
    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

    i am having troubles with a point and click game, i have it set up if click in a certian spot the frame you are viewing changes and then there are different things to click, but the click from the frame before effects my new frame. this is hard to explain so i have a gif video to show what i mean,
    its going kinda fast (first time using the recording prx), the black bar is the begining. I have a flashlight in one frame and when you click on it it should dissapaire. you can see (i hope) from the image that when I click on the box the first time the flashlight was there, but when went back and did it a second time right where the flashlight would be in the next frame it is gone. Is there any way to make my clicks (with X) not effect my next frame?
    here is part of my code
    Code:
    -- First Frame
    if currentpic == 1 then
    -- Box
    if cursor.x >= 201 and cursor.x <= 288 and cursor.y >= 245 and cursor.y <= 272 then
    if pad:cross() and oldpad:cross() ~= pad:cross()  then
    currentpic = 7
    end
    end
    end-- First Frame
    -- Box Top
    if currentpic == 7 then
    if cursor.x >= 116 and cursor.x <= 480 and cursor.y >= 112 and cursor.y <= 235 then
    if pad:cross() and oldpad:cross() ~= pad:cross()  then
    currentpic = 15
    end
    end
    end -- Box Top
    -- Flash Light
    if currentpic == 15 and f_light == 0 then
    if cursor.x >= 219 and cursor.x <= 281 and cursor.y >= 162 and cursor.y <= 249 then
    if pad:cross() and oldpad:cross() ~= pad:cross()  then
    f_light = 1
    end
    end
    end -- Flash Light
    i have used the pad and oldpad tecnique but that doesnt effect it. is there anyway to stop this from happening?
    ...

  24. #10104
    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

    Set up a delay between presses. Easiest way is to have a int increase by 1 every frame.
    If number > int then
    number = int
    end

    then on button presses add, & number == int then. Obviously you should experiment with 'int' to find a delay that suites your game.

  25. #10105
    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

    using a timer or delay function woud be better though
    ------ 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).

  26. #10106
    QJ Gamer Bronze
    Points: 5.381, Level: 47
    Level completed: 16%, Points required for next Level: 169
    Overall activity: 0%

    Registriert seit
    Jul 2006
    Beiträge
    550
    Points
    5.381
    Level
    47
    Downloads
    1
    Uploads
    0

    Standard

    Not having such a crappy structure would be better - don't freaking hardcode everything, you'll never get anywhere.

    Fix it by only processing one per loop, Jesus.

  27. #10107
    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

    i couldnt make the counter or timer work, but i played around with the order and it works now:o. Niekie what do you mean by hardcoding everything?
    ...

  28. #10108
    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

    Most probably you could make a function that accepts the picture and some x, y, width, height values for the place to click and simple call that when cross is pressed instead of coding the same thing 7 times.

    I actually havent looked at your code i was just inputting that using a timer is better than incrememnting a counter for time reasons as a counter is dependant on how fast your loop is where a timer is not.
    ------ 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).

  29. #10109
    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

    actually i didnt really just code it seven times, i have done that exact method of coding for my whole port of a game and i am nearly finished. Thank you for your input though, hopefuly the next time I do a game i can remeber to do that.
    ...

  30. #10110
    QJ Gamer Green
    Points: 3.008, Level: 33
    Level completed: 72%, Points required for next Level: 42
    Overall activity: 0%

    Registriert seit
    May 2008
    Beiträge
    96
    Points
    3.008
    Level
    33
    Downloads
    0
    Uploads
    0

    Standard

    Zitat Zitat von dan369 Beitrag anzeigen
    tables = lua, pge =api.

    table = {}
    I tried what ever you saidbut the game still freezes...
    can you turn this in a table used in PGE
    Code:
    local player1 =
    {
    {x=10, y=10, health=500, lvl=1 , dmg=50, exp=100 , image="images/Player/playerright.png",weapon="sword", magic="SunFire", mana = 100, casting = 0, attacking = 0}
    }


 

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

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