Zeige Ergebnis 9.151 bis 9.180 von 10238
Lua Programming Help Thread
This is a discussion on Lua Programming Help Thread within the PSP Development Forum forums, part of the PSP Development, Hacks, and Homebrew category; yea i would have done that anyways...
-
08-06-2008, 04:33 PM #9151
Achievements:
- Registriert seit
- Aug 2008
- Beiträge
- 13
- Points
- 2.355
- Level
- 29
- Downloads
- 0
- Uploads
- 0
yea i would have done that anyways
-
08-06-2008, 04:43 PM #9152Lua guy
- Registriert seit
- Jan 2008
- Ort
- Wales, cardiff
- Beiträge
- 1.442
- Points
- 11.690
- Level
- 71
- My Mood
-
- Downloads
- 0
- Uploads
- 0
though u can re-use them thats wat i meant. 4 better Anim use animLib
-
08-06-2008, 05:47 PM #9153
Achievements:
- Registriert seit
- Aug 2008
- Beiträge
- 13
- Points
- 2.355
- Level
- 29
- Downloads
- 0
- Uploads
- 0
just for now im gonna stick with animation without libraries, better for me to learn
-
08-06-2008, 06:42 PM #9154QJ Gamer Bronze

- Registriert seit
- Jul 2006
- Beiträge
- 550
- Points
- 5.381
- Level
- 47
- Downloads
- 1
- Uploads
- 0
That is absolutely horrible code. Do not try help people untill you have a better grasp of the language yourself.
Ever heard of tables and math?
Why? You should only need one timer for all animations.Forgot That. Have a drifferent timer 4 each animation, e.g timer2 = 0, timer3 = 0 etc
You should be able to make something as good as animLib yourself. Animation, as well as sprite sheets are not difficult. Pay more attention in Maths, and read up on data structures (Such as Lua's tables.)4 better Anim use animLib
-
08-06-2008, 07:06 PM #9155
Achievements:
- Registriert seit
- Aug 2008
- Beiträge
- 13
- Points
- 2.355
- Level
- 29
- Downloads
- 0
- Uploads
- 0
in no way were his intention for me to copy and paste that code or even copy and paste and modify slightly but give me a hint on a way to do sprite animation via a counter
-
08-06-2008, 07:39 PM #9156QJ Gamer Bronze

- Registriert seit
- Jul 2006
- Beiträge
- 550
- Points
- 5.381
- Level
- 47
- Downloads
- 1
- Uploads
- 0
-
08-06-2008, 07:52 PM #9157
Achievements:
- Registriert seit
- Aug 2008
- Beiträge
- 13
- Points
- 2.355
- Level
- 29
- Downloads
- 0
- Uploads
- 0
why so negative? technically the worst is a way not working at all.
so if your so smart then what is the best/way you recommend
-
08-06-2008, 07:57 PM #9158QJ Gamer Green
- Registriert seit
- Jan 2008
- Beiträge
- 612
- Points
- 3.721
- Level
- 38
- Downloads
- 0
- Uploads
- 0
A method similar to what I recommended or one you make on your own, but that would require too much comprehension and understanding on your part and thus is fairly pointless until you actually learn to do things on your own in the world of programming.
-
08-07-2008, 01:06 AM #9159Lua guy
- Registriert seit
- Jan 2008
- Ort
- Wales, cardiff
- Beiträge
- 1.442
- Points
- 11.690
- Level
- 71
- My Mood
-
- Downloads
- 0
- Uploads
- 0
-
08-07-2008, 01:40 AM #9160QJ Gamer Silver

- Registriert seit
- Jun 2006
- Ort
- UK
- Beiträge
- 2.326
- Points
- 10.263
- Level
- 67
- Downloads
- 0
- Uploads
- 0
Look at the animation snippet I did here: Lua Code Snippets I did a while back...
[Blog] [Portfolio]
[Homebrew Illuminati - Serious Homebrew Development Forums]
[I want to make Homebrew FAQ] [How I broke into the Games Industry]
[Programming Book List] [Programming Article List]
-
08-07-2008, 01:45 AM #9161Lua guy
- Registriert seit
- Jan 2008
- Ort
- Wales, cardiff
- Beiträge
- 1.442
- Points
- 11.690
- Level
- 71
- My Mood
-
- Downloads
- 0
- Uploads
- 0
-
08-07-2008, 02:15 AM #9162QJ Gamer Silver

- Registriert seit
- Jun 2006
- Ort
- UK
- Beiträge
- 2.326
- Points
- 10.263
- Level
- 67
- Downloads
- 0
- Uploads
- 0
Yes I am.
[Blog] [Portfolio]
[Homebrew Illuminati - Serious Homebrew Development Forums]
[I want to make Homebrew FAQ] [How I broke into the Games Industry]
[Programming Book List] [Programming Article List]
-
08-07-2008, 04:36 AM #9163Lua guy
- Registriert seit
- Jan 2008
- Ort
- Wales, cardiff
- Beiträge
- 1.442
- Points
- 11.690
- Level
- 71
- My Mood
-
- Downloads
- 0
- Uploads
- 0
Hummmhh....... SpirteSheets. After looking through yaustars example. I got confused.
So could someone explain???
-
08-07-2008, 04:39 AM #9164Banned for LIFE
- Registriert seit
- Oct 2006
- Ort
- East London, England
- Beiträge
- 2
- Points
- 18.744
- Level
- 86
- Downloads
- 0
- Uploads
- 0
If I remember correctly it is very well commented ...
-
08-07-2008, 04:40 AM #9165Lua guy
- Registriert seit
- Jan 2008
- Ort
- Wales, cardiff
- Beiträge
- 1.442
- Points
- 11.690
- Level
- 71
- My Mood
-
- Downloads
- 0
- Uploads
- 0
After looking through yaustars example i got pretty confused.
Not with the animation but with the first function.
it said sumthing like setmetatable???
what is that?????
-
08-07-2008, 04:42 AM #9166Banned for LIFE
- Registriert seit
- Oct 2006
- Ort
- East London, England
- Beiträge
- 2
- Points
- 18.744
- Level
- 86
- Downloads
- 0
- Uploads
- 0
-
08-07-2008, 04:57 AM #9167Lua guy
- Registriert seit
- Jan 2008
- Ort
- Wales, cardiff
- Beiträge
- 1.442
- Points
- 11.690
- Level
- 71
- My Mood
-
- Downloads
- 0
- Uploads
- 0
Thanks, it was thinking y the 2 __?? but now i know.
And why there's index, it refers it to a table.
Thanks
-
08-07-2008, 08:19 AM #9168QJ Gamer Green
- Registriert seit
- Jan 2008
- Beiträge
- 612
- Points
- 3.721
- Level
- 38
- Downloads
- 0
- Uploads
- 0
You CANNOT halfass your way around with metatables - you HAVE to learn them. Lua-users.org has some very good articles on how metatables (or even normal ones) can be used to trick your way into OOP in lua, and that's exactly what most people use them for.
-
08-07-2008, 09:18 AM #9169Lua guy
- Registriert seit
- Jan 2008
- Ort
- Wales, cardiff
- Beiträge
- 1.442
- Points
- 11.690
- Level
- 71
- My Mood
-
- Downloads
- 0
- Uploads
- 0
Ok another question. I have 4 drifferent tiles in one img.
How would i code it so that it will take each img (32x32) and but it simply into a number on a map so that 1 would represent the first img etc.
???
-
08-07-2008, 09:40 AM #9170Banned for LIFE
- Registriert seit
- Oct 2006
- Ort
- East London, England
- Beiträge
- 2
- Points
- 18.744
- Level
- 86
- Downloads
- 0
- Uploads
- 0
Why dont you make your life easier and just use four seperate images ?
-
08-07-2008, 09:50 AM #9171
you could setup an SDL_Rect for each tile in the image. I dont know what luaplayer functions there are for this sort of thing. just calculate tile_index * width_of_tile to get the start offset for that tile. just remember youd need to blit 32 pixels then add tile_sheet_image_width - 32 to get to the next row in the tile. But if luaplayer gives you access to SDL_Rect's then that woud be a lot easier.
-- Code Monkey : Sarien, Fishguts, Cracks and Crevices --
"Did IQ's just drop sharply while I was away?" (Ripley)
-
08-07-2008, 10:06 AM #9172Lua guy
- Registriert seit
- Jan 2008
- Ort
- Wales, cardiff
- Beiträge
- 1.442
- Points
- 11.690
- Level
- 71
- My Mood
-
- Downloads
- 0
- Uploads
- 0
thanks i understand.
calculate the img width and height of each tile which is 32x32
Then put into a seperate array??
-
08-07-2008, 10:15 AM #9173QJ Gamer Blue
- Registriert seit
- Apr 2008
- Beiträge
- 497
- Points
- 4.268
- Level
- 41
- Downloads
- 0
- Uploads
- 0
ok, I have a question, I'm working on a battle system demo, and I am working on Ai for it, I have a function that takes away 5 health when the AI attacks, but it continues to take 5 health continuosly, how do I make it only take away 5 points per turn (I'm doing turn based battlesystem) I am thinking something like monster.attack and oldmonster.attack, but I'm not sure.
-
08-07-2008, 10:21 AM #9174QJ Gamer Silver

- Registriert seit
- Jun 2006
- Ort
- UK
- Beiträge
- 2.326
- Points
- 10.263
- Level
- 67
- Downloads
- 0
- Uploads
- 0
[Blog] [Portfolio]
[Homebrew Illuminati - Serious Homebrew Development Forums]
[I want to make Homebrew FAQ] [How I broke into the Games Industry]
[Programming Book List] [Programming Article List]
-
08-07-2008, 10:21 AM #9175
sure, you can precalc your offsets, its really only handy when you have a sprite sheet that is more than 1 line of sprites deep, since if its just 1 row, its just an index * 32 calculation.
but you could if you wanted to precalc you could do something like
putting the sprite sheet in there, you can load mutliple sprites into the one table, or extra things like a transparency colour, etcCode:sprites = {} function CalcSprites(sprite_sheet, sheet_width, sheet_height, sprite_height, sprite_width) local row local col for row = 0, sheet_height / sprite_height do for col = 0 .. sheet_width / sprite_width do sprites[#sprites] = { width = sprite_width, height = sprite_height, sheet = sprite_sheet, offset = (row * sprite_height) + (col * sprite_width) } end end end-- Code Monkey : Sarien, Fishguts, Cracks and Crevices --
"Did IQ's just drop sharply while I was away?" (Ripley)
-
08-07-2008, 10:25 AM #9176QJ Gamer Blue
- Registriert seit
- Apr 2008
- Beiträge
- 497
- Points
- 4.268
- Level
- 41
- Downloads
- 0
- Uploads
- 0
@yuastar: should I have 2 different loops, for each turn?? one for characters, and one for enemies??
-
08-07-2008, 10:34 AM #9177Lua guy
- Registriert seit
- Jan 2008
- Ort
- Wales, cardiff
- Beiträge
- 1.442
- Points
- 11.690
- Level
- 71
- My Mood
-
- Downloads
- 0
- Uploads
- 0
Sorry, i should of said its 4 a tilemap. I've dun it know. Anyway.
Then should I do sumthing like this‚Code:function getTileWidth() Width = tiles:Width tileWidth = {} if Width then Width = Width / 2 table.insert(tileWidth, width) end
Would That work....?????Code:tiledata = { tileWidth[1], tileWidth[2] }Geändert von dan369 (08-07-2008 um 12:36 PM Uhr)
-
08-07-2008, 10:32 PM #9178QJ Gamer Blue
- Registriert seit
- Apr 2008
- Beiträge
- 497
- Points
- 4.268
- Level
- 41
- Downloads
- 0
- Uploads
- 0
BTW: @yuastar: I figured it out thank you
-
08-08-2008, 11:45 PM #9179
Achievements:
- Registriert seit
- Aug 2008
- Beiträge
- 8
- Points
- 1.864
- Level
- 25
- Downloads
- 0
- Uploads
- 0
i have a question. how do you make 3d lua applications?
-
08-09-2008, 12:17 AM #9180QJ Gamer Green
- Registriert seit
- Jan 2008
- Beiträge
- 612
- Points
- 3.721
- Level
- 38
- Downloads
- 0
- Uploads
- 0
For a very basic screw understanding it but know how to do it kind of tutorial, check here:
http://tacticalpenguin.com/snippets/3d.txt


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