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 ...
-
07-14-2009, 12:44 PM #10081QJ Gamer Blue
Achievements:
- Registriert seit
- May 2009
- Beiträge
- 106
- Points
- 2.716
- Level
- 31
- Downloads
- 0
- Uploads
- 0
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.
-
07-15-2009, 04:44 AM #10082QJ Gamer Bronze

- Registriert seit
- Dec 2007
- Ort
- B.F.
- Beiträge
- 328
- Points
- 7.257
- Level
- 56
- My Mood
-
- Downloads
- 1
- Uploads
- 0
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.
Here is is the result, very far from my goal..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
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.
-
07-15-2009, 07:00 AM #10083Developer and Tutor.
- Registriert seit
- Jul 2007
- Ort
- Widnes, England
- Beiträge
- 1.649
- Points
- 8.736
- Level
- 62
- My Mood
-
- Downloads
- 0
- Uploads
- 0
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).
-
07-15-2009, 07:39 AM #10084QJ Gamer Bronze

- Registriert seit
- Dec 2007
- Ort
- B.F.
- Beiträge
- 328
- Points
- 7.257
- Level
- 56
- My Mood
-
- Downloads
- 1
- Uploads
- 0
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.
-
07-15-2009, 07:41 AM #10085Developer and Tutor.
- Registriert seit
- Jul 2007
- Ort
- Widnes, England
- Beiträge
- 1.649
- Points
- 8.736
- Level
- 62
- My Mood
-
- Downloads
- 0
- Uploads
- 0
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).
-
07-15-2009, 07:51 AM #10086QJ Gamer Bronze

- Registriert seit
- Dec 2007
- Ort
- B.F.
- Beiträge
- 328
- Points
- 7.257
- Level
- 56
- My Mood
-
- Downloads
- 1
- Uploads
- 0
Any pics, with colored lozenges should fit nicely.But just take these ones.
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.
-
07-15-2009, 08:19 AM #10087Developer and Tutor.
- Registriert seit
- Jul 2007
- Ort
- Widnes, England
- Beiträge
- 1.649
- Points
- 8.736
- Level
- 62
- My Mood
-
- Downloads
- 0
- Uploads
- 0
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).
-
07-15-2009, 08:28 AM #10088QJ Gamer Bronze

- Registriert seit
- Dec 2007
- Ort
- B.F.
- Beiträge
- 328
- Points
- 7.257
- Level
- 56
- My Mood
-
- Downloads
- 1
- Uploads
- 0
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.
-
07-15-2009, 12:53 PM #10089Lua Coder

- Registriert seit
- Jan 2008
- Ort
- Iowa
- Beiträge
- 834
- Points
- 18.915
- Level
- 87
- My Mood
-
- Downloads
- 2
- Uploads
- 0
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
...
-
07-15-2009, 11:58 PM #10090QJ Gamer Bronze

- Registriert seit
- Dec 2007
- Ort
- B.F.
- Beiträge
- 328
- Points
- 7.257
- Level
- 56
- My Mood
-
- Downloads
- 1
- Uploads
- 0
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
I guess this fits for you.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() end00: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.
-
07-16-2009, 04:51 AM #10091QJ Gamer Bronze

- Registriert seit
- Dec 2007
- Ort
- B.F.
- Beiträge
- 328
- Points
- 7.257
- Level
- 56
- My Mood
-
- Downloads
- 1
- Uploads
- 0
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 ?
I've attached a zip file containing the code & pics.Thanks for trying it.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() end00: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.
-
07-16-2009, 05:37 AM #10092Lua Coder

- Registriert seit
- Jan 2008
- Ort
- Iowa
- Beiträge
- 834
- Points
- 18.915
- Level
- 87
- My Mood
-
- Downloads
- 2
- Uploads
- 0
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...
-
07-16-2009, 08:11 AM #10093Developer and Tutor.
- Registriert seit
- Jul 2007
- Ort
- Widnes, England
- Beiträge
- 1.649
- Points
- 8.736
- Level
- 62
- My Mood
-
- Downloads
- 0
- Uploads
- 0
------ 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).
-
07-16-2009, 08:23 AM #10094Developer and Tutor.
- Registriert seit
- Jul 2007
- Ort
- Widnes, England
- Beiträge
- 1.649
- Points
- 8.736
- Level
- 62
- My Mood
-
- Downloads
- 0
- Uploads
- 0
------ 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).
-
07-17-2009, 04:09 AM #10095Developer and Tutor.
- Registriert seit
- Jul 2007
- Ort
- Widnes, England
- Beiträge
- 1.649
- Points
- 8.736
- Level
- 62
- My Mood
-
- Downloads
- 0
- Uploads
- 0
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).
-
07-17-2009, 05:17 AM #10096Developer
Achievements:
- Registriert seit
- Nov 2008
- Beiträge
- 71
- Points
- 13.989
- Level
- 76
- Downloads
- 0
- Uploads
- 0
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.
-
07-17-2009, 05:30 AM #10097QJ Gamer Bronze

- Registriert seit
- Dec 2007
- Ort
- B.F.
- Beiträge
- 328
- Points
- 7.257
- Level
- 56
- My Mood
-
- Downloads
- 1
- Uploads
- 0
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.
-
07-17-2009, 05:30 AM #10098Developer and Tutor.
- Registriert seit
- Jul 2007
- Ort
- Widnes, England
- Beiträge
- 1.649
- Points
- 8.736
- Level
- 62
- My Mood
-
- Downloads
- 0
- Uploads
- 0
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).
-
07-17-2009, 08:47 AM #10099QJ Gamer Green
- Registriert seit
- Jul 2008
- Ort
- In your pocket.
- Beiträge
- 192
- Points
- 5.875
- Level
- 49
- My Mood
-
- Downloads
- 0
- Uploads
- 0
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
-
07-17-2009, 09:05 AM #10100Lua guy
- Registriert seit
- Jan 2008
- Ort
- Wales, cardiff
- Beiträge
- 1.442
- Points
- 11.690
- Level
- 71
- My Mood
-
- Downloads
- 0
- Uploads
- 0
fonts are always powers of 2.....
49 != power of 2
40 == and 48 == power of 2
-
07-18-2009, 05:03 PM #10101QJ Gamer Green
- Registriert seit
- May 2008
- Beiträge
- 96
- Points
- 3.008
- Level
- 33
- Downloads
- 0
- Uploads
- 0
Can someone tell me how to start tables in PGE?
-
07-18-2009, 05:04 PM #10102Lua guy
- Registriert seit
- Jan 2008
- Ort
- Wales, cardiff
- Beiträge
- 1.442
- Points
- 11.690
- Level
- 71
- My Mood
-
- Downloads
- 0
- Uploads
- 0
tables = lua, pge =api.
table = {}
-
07-19-2009, 09:23 PM #10103Lua Coder

- Registriert seit
- Jan 2008
- Ort
- Iowa
- Beiträge
- 834
- Points
- 18.915
- Level
- 87
- My Mood
-
- Downloads
- 2
- Uploads
- 0
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
i have used the pad and oldpad tecnique but that doesnt effect it. is there anyway to stop this from happening?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
...
-
07-19-2009, 10:04 PM #10104Lua guy
- Registriert seit
- Jan 2008
- Ort
- Wales, cardiff
- Beiträge
- 1.442
- Points
- 11.690
- Level
- 71
- My Mood
-
- Downloads
- 0
- Uploads
- 0
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.
-
07-20-2009, 12:44 AM #10105Developer and Tutor.
- Registriert seit
- Jul 2007
- Ort
- Widnes, England
- Beiträge
- 1.649
- Points
- 8.736
- Level
- 62
- My Mood
-
- Downloads
- 0
- Uploads
- 0
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).
-
07-20-2009, 12:51 AM #10106QJ Gamer Bronze

- Registriert seit
- Jul 2006
- Beiträge
- 550
- Points
- 5.381
- Level
- 47
- Downloads
- 1
- Uploads
- 0
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.
-
07-20-2009, 10:42 AM #10107Lua Coder

- Registriert seit
- Jan 2008
- Ort
- Iowa
- Beiträge
- 834
- Points
- 18.915
- Level
- 87
- My Mood
-
- Downloads
- 2
- Uploads
- 0
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?
...
-
07-20-2009, 11:07 AM #10108Developer and Tutor.
- Registriert seit
- Jul 2007
- Ort
- Widnes, England
- Beiträge
- 1.649
- Points
- 8.736
- Level
- 62
- My Mood
-
- Downloads
- 0
- Uploads
- 0
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).
-
07-20-2009, 12:01 PM #10109Lua Coder

- Registriert seit
- Jan 2008
- Ort
- Iowa
- Beiträge
- 834
- Points
- 18.915
- Level
- 87
- My Mood
-
- Downloads
- 2
- Uploads
- 0
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.
...
-
07-20-2009, 07:14 PM #10110QJ Gamer Green
- Registriert seit
- May 2008
- Beiträge
- 96
- Points
- 3.008
- Level
- 33
- Downloads
- 0
- Uploads
- 0
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} }


LinkBack URL
About LinkBacks
Mit Zitat antworten

Hello everyone I am new here and I am glad to be part of this amazing community and I think there...
New to forum