Submit Your Own Code

PSP Lua CodeBase : Simple Collision Box

Description:
this code assumes that your pictures are set up like this:
pic1={}
pic1[img] = Image.load( "./imgs/pic1.png" )
pic1[x] = 52
pic1[y] = 126

arguments are the picture tables: checkcollision(pic1 , pic2)

PLEASE NOTE: UNTESTED but should work.

-- EVILMANA.COM PSP LUA CODEBASE
-- www.evilmana.com/tutorials/codebase
-- Simple Box Collision
-- SUBMITTED BY: nathan42100
function checkCollision(col1 , col2)
if col1[x]>=col2[x] and col1[x]<=(col2[x] + col2[img]:width()) then
if col1[y]>=col2[y] and col2[y]<=(col2[y] + col2[img]:height()) then
return true
end
else
return false
end
end

Back to CodeBase

Please welcome jramada, our newest member.

Who's Online: 1 Guest, 0 Users

Total Members: 555
Total Posts: 13057
Total Topics: 1480
Total Categories: 8
Total Boards: 35

Recent Posts:

Re: Lua Loader? by osgeld
Re: Lua Loader? by acer5050
Re: Lua Loader? by bumuckl
Re: Lua Loader? by acer5050
Re: Lua Loader? by bumuckl
Lua Loader? by acer5050
Re: PGELua Help - need term for a special rotation fix (mathematical issue) by bumuckl
Re: PGELua Help - need term for a special rotation fix (mathematical issue) by tacticalpenguin


Copyright © 2006-2007 www.EvilMana.com All rights reserved.
EvilMana Logo by emcp and Charlie