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 

what is wrong with this code (or lua)?

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



Joined: 03 Oct 2005
Posts: 17

PostPosted: Mon Oct 03, 2005 5:04 am    Post subject: what is wrong with this code (or lua)? Reply with quote

Code:
   
        -- input handling
    if pad:l() then
        ship.aimdir = relative(ship.aimdir +2)
        end
    if pad:r() then
        ship.aimdir = relative(ship.aimdir -2)
        end
       
    ship.aimdir = math.abs(ship.aimdir)
   
    if ship.aimdir > 360 then
        ship.aimdir = ship.aimdir -360
        end
    if ship.aimdir <0 then
        ship.aimdir = ship.aimdir +360
        end



the ships aiming will go round anti clockwise (when ship.aimdir is being +ed) but if you go clockwise it gets stuck at the ship.aimdir = 0 mark.

i use this pice of code in loads of other languages and it works great.

whats going on??

edit: oops nver mind there is an unneccessary math.abs in there
Back to top
View user's profile Send private message
chaos



Joined: 10 Apr 2005
Posts: 135

PostPosted: Mon Oct 03, 2005 7:59 am    Post subject: Reply with quote

isn't it funny how you can always spot the answer 5 minutes after making a thread about it? :)
_________________
Chaosmachine Studios: High Quality Homebrew.
Back to top
View user's profile Send private message
BePe86



Joined: 02 Oct 2005
Posts: 10
Location: Norway

PostPosted: Mon Oct 03, 2005 8:39 am    Post subject: Reply with quote

lol, it's an universal law :P
_________________
EU PSP 1.52 -> 2.0 -> 1.50
Untold Legends
32MB + 1GB Memory Sticks
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