| View previous topic :: View next topic |
| Author |
Message |
Shine
Joined: 03 Dec 2004 Posts: 728 Location: Germany
|
Posted: Wed Oct 05, 2005 7:31 am Post subject: Lua Player WiKi |
|
|
I've created an entry in the ps2dev Wiki for Lua Player (follow the Lua Player link) :
http://wiki.ps2dev.org/
Everybody can edit it, after registering at the Wiki system. Maybe this is useful for not to forget important things in a stream of forum posts and to collect other important information about Lua Player, game projects etc. |
|
| Back to top |
|
 |
JoshDB

Joined: 05 Oct 2005 Posts: 87
|
Posted: Thu Oct 06, 2005 2:41 am Post subject: |
|
|
| You should enable HTML for easy jump-to code and text coloring effects. |
|
| Back to top |
|
 |
LuMo
Joined: 21 Aug 2005 Posts: 410 Location: Austria
|
Posted: Thu Oct 06, 2005 2:46 am Post subject: |
|
|
here is an tutorial how to edit wiki _________________ "Good artists copy, great artists steal."
Pablo Picasso
go2lumo.com |
|
| Back to top |
|
 |
jimjamjahaa
Joined: 03 Oct 2005 Posts: 17
|
Posted: Thu Oct 06, 2005 3:52 am Post subject: |
|
|
over the years i have made lots of scripts for game dev. i ported over one of the most useful functions ever. here it is, i hope someone could put it in the wiki (i cant be bothered to learn how)
| Code: |
-- you need to set pi as a global variable = to pi
function point_direction(x1,y1,x2,y2)
_x = x2 - x1
_y = y1 - y2
if _x == 0 then
if _y == 0 then
return 0
end
if _y > 0 then
return 90
end
if _y < 0 then
return 270
end
end
_i = math.abs(_x) + math.abs(_y)
_x = _x / _i
_y = _y / _i
rd = math.atan(_y/_x)
if _x <0 then
rd = rd + pi
end
if _x > 0 and _y < 0 then
rd = 2*pi + rd
end
return rd * 180 / pi
end
|
by the way, what is the square root function in lua?
Last edited by jimjamjahaa on Fri Oct 07, 2005 6:14 am; edited 2 times in total |
|
| Back to top |
|
 |
LuMo
Joined: 21 Aug 2005 Posts: 410 Location: Austria
|
Posted: Thu Oct 06, 2005 3:55 am Post subject: |
|
|
google says what i expected it to say... math.sqrt() _________________ "Good artists copy, great artists steal."
Pablo Picasso
go2lumo.com |
|
| Back to top |
|
 |
jimjamjahaa
Joined: 03 Oct 2005 Posts: 17
|
Posted: Thu Oct 06, 2005 4:02 am Post subject: |
|
|
| chrz. yeah i shud have googled.... meh |
|
| Back to top |
|
 |
Shine
Joined: 03 Dec 2004 Posts: 728 Location: Germany
|
Posted: Thu Oct 06, 2005 5:57 am Post subject: |
|
|
| jimjamjahaa wrote: | function point_direction(x1,y1,x2,y2)
|
Nice, but you should take a look at Math.atan2 :-) |
|
| Back to top |
|
 |
jimjamjahaa
Joined: 03 Oct 2005 Posts: 17
|
Posted: Fri Oct 07, 2005 6:12 am Post subject: |
|
|
eek! dont tell me i did that for nothing!? oh well.
where do you find documentation on the math library. on the official lua site it didnt go over it in any detail |
|
| Back to top |
|
 |
Shine
Joined: 03 Dec 2004 Posts: 728 Location: Germany
|
|
| Back to top |
|
 |
KawaGeo
Joined: 27 Aug 2005 Posts: 191 Location: Calif Mountains
|
Posted: Fri Oct 07, 2005 7:07 am Post subject: |
|
|
If you goodle the site, use the following and you'll find what you want.
site:http://lua-users.org/wiki/ math
or use any other searching word(s) you want in the place of "math". _________________ Geo Massar
Retired Engineer |
|
| Back to top |
|
 |
Shine
Joined: 03 Dec 2004 Posts: 728 Location: Germany
|
Posted: Sat Oct 08, 2005 10:52 am Post subject: |
|
|
| I've added the tutorial to the Wiki, feel free to enhance it like you want, I think it needs some more explanations for example for the Pac Man game and maybe you want to fix my grammar, spelling and bad English erros, which I'm sure are in the text. I've deleted JoshDB's code, because it was nearly the same as the sample in the tutorial for the analog pad. And don't forget to use the nice [code lua] feature for syntax highlighting Lua code :-) |
|
| Back to top |
|
 |
|