QJ.NET | Videos | Forums | iPhone | MMORPG | Nintendo DS | Wii | PlayStation 3 | PSP | Xbox 360 | PC | Downloads | Contact Us
Forums | Gaming News | Videos | Downloads | Today's Posts | Mark Forums Read | Chat | FAQ | Members List | Contact

QJ.net Game Discussion - PSP, Xbox, Wii, PS3, PSP Homebrew, and PSP Guides

Go Back   QJ.net Game Discussion - PSP, Xbox, Wii, PS3, PSP Homebrew, and PSP Guides > Developers Corner > PSP Development, Hacks, and Homebrew > PSP Development Forum
The above video goes away if you are a member and logged in, so log in now!

Better Way For Collision In Lua?

This is a discussion on Better Way For Collision In Lua? within the PSP Development Forum forums, part of the PSP Development, Hacks, and Homebrew category; The way I'm using collision for walls so far is this. I've made a function which is: Code: function wallcollision(x1,x2,y1,y2) ...

Reply
 
LinkBack Thread Tools
Old 09-21-2005, 11:13 AM   #1
 
Join Date: Sep 2005
Posts: 2
Trader Feedback: 0
Question Better Way For Collision In Lua?

The way I'm using collision for walls so far is this. I've made a function which is:

Code:
function wallcollision(x1,x2,y1,y2)
if x > x1 and x < x2 and y > y1 and y < y2 then
x = oldx 
y = oldy 
end
end
So basicly it creates a square or rectangle area which cannot be walked through by the player. It is called in the game like so:

Code:
wallcollision(0,450,0,14) -- top wall
wallcollision(87,123,0,93) -- top up and down left side
wallcollision(337,374,0,92) -- top up and down right side
wallcollision(0,15,0,271) -- left side wall
wallcollision(0,166,162,196) -- mid wall left to right left side
wallcollision(0,470,243,271) -- bottom wall
wallcollision(224,262,56,97)  -- middle square piece
wallcollision(205,275,95,182) -- middle round piece
wallcollision(447,480,0,280) -- right side wall
The annoying part is that for every single wall I have to manually get the coordinates to make collision for that wall. I'm sure someone has a better and quicker way, if so I'd like to know.
charlie2k4 is offline  
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
Old 09-21-2005, 02:47 PM   #2

OMFG
 
Slasher's Avatar
 
Join Date: Jul 2005
Location: Toronto
Posts: 2,816
Trader Feedback: 0
Default

something to do with image:height() and image:width()...unless you don't mind manually finding coordinates
Slasher is offline  
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
Old 09-21-2005, 05:01 PM   #3
 
Join Date: Sep 2005
Posts: 2
Trader Feedback: 0
Default

Doesn't tell me much...
charlie2k4 is offline  
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
Reply

Tags
collision , lua

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are Off
Pingbacks are Off
Refbacks are Off



All times are GMT -8. The time now is 12:13 PM.



Use of this Web site constitutes acceptance of the TERMS & CONDITIONS and PRIVACY POLICY
Copyright © 2009, QJ.NET. All Rights Reserved.
Contact Us