forums.ps2dev.org Forum Index forums.ps2dev.org
Homebrew PS2, PSP & PS3 Development Discussions
 
 FAQFAQ   SearchSearch   MemberlistMemberlist   UsergroupsUsergroups   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

Lua Player WiKi

 
Post new topic   Reply to topic    forums.ps2dev.org Forum Index -> PSP Lua Player Development
View previous topic :: View next topic  
Author Message
Shine



Joined: 03 Dec 2004
Posts: 728
Location: Germany

PostPosted: Wed Oct 05, 2005 7:31 am    Post subject: Lua Player WiKi Reply with quote

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
View user's profile Send private message
JoshDB



Joined: 05 Oct 2005
Posts: 87

PostPosted: Thu Oct 06, 2005 2:41 am    Post subject: Reply with quote

You should enable HTML for easy jump-to code and text coloring effects.
Back to top
View user's profile Send private message Send e-mail AIM Address
LuMo



Joined: 21 Aug 2005
Posts: 410
Location: Austria

PostPosted: Thu Oct 06, 2005 2:46 am    Post subject: Reply with quote

here is an tutorial how to edit wiki
_________________
"Good artists copy, great artists steal."
Pablo Picasso
go2lumo.com
Back to top
View user's profile Send private message Visit poster's website
jimjamjahaa



Joined: 03 Oct 2005
Posts: 17

PostPosted: Thu Oct 06, 2005 3:52 am    Post subject: Reply with quote

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
View user's profile Send private message
LuMo



Joined: 21 Aug 2005
Posts: 410
Location: Austria

PostPosted: Thu Oct 06, 2005 3:55 am    Post subject: Reply with quote

google says what i expected it to say... math.sqrt()
_________________
"Good artists copy, great artists steal."
Pablo Picasso
go2lumo.com
Back to top
View user's profile Send private message Visit poster's website
jimjamjahaa



Joined: 03 Oct 2005
Posts: 17

PostPosted: Thu Oct 06, 2005 4:02 am    Post subject: Reply with quote

chrz. yeah i shud have googled.... meh
Back to top
View user's profile Send private message
Shine



Joined: 03 Dec 2004
Posts: 728
Location: Germany

PostPosted: Thu Oct 06, 2005 5:57 am    Post subject: Reply with quote

jimjamjahaa wrote:
function point_direction(x1,y1,x2,y2)

Nice, but you should take a look at Math.atan2 :-)
Back to top
View user's profile Send private message
jimjamjahaa



Joined: 03 Oct 2005
Posts: 17

PostPosted: Fri Oct 07, 2005 6:12 am    Post subject: Reply with quote

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
View user's profile Send private message
Shine



Joined: 03 Dec 2004
Posts: 728
Location: Germany

PostPosted: Fri Oct 07, 2005 6:21 am    Post subject: Reply with quote

jimjamjahaa wrote:
where do you find documentation on the math library. on the official lua site it didnt go over it in any detail


http://lua-users.org/wiki/MathLibraryTutorial
Back to top
View user's profile Send private message
KawaGeo



Joined: 27 Aug 2005
Posts: 191
Location: Calif Mountains

PostPosted: Fri Oct 07, 2005 7:07 am    Post subject: Reply with quote

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
View user's profile Send private message Send e-mail
Shine



Joined: 03 Dec 2004
Posts: 728
Location: Germany

PostPosted: Sat Oct 08, 2005 10:52 am    Post subject: Reply with quote

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
View user's profile Send private message
Display posts from previous:   
Post new topic   Reply to topic    forums.ps2dev.org Forum Index -> PSP Lua Player Development All times are GMT + 10 Hours
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


Powered by phpBB © 2001, 2005 phpBB Group