Latest Uploads
Extraterre ... .0.1 (zip)

dantheman363

Monty Teas ... Screenie 1

steve_ancell

Santa Clau ... ed his bag

waroffice

manic_platdude.png

spinal

Tetris Clone

steve_ancell

Super blues bros.

spinal

Code Snippets > Collisions and Physics ( Created 04 April 2012 | Last Edited 04 April 2012)

Pixel Perfect Collision by melmantheman | No Votes
Helps to make pixel perfect(accurate down to a pixel) collisions using image RGB values and
Written in
Java
-->

Were as:
*collide is image for collision
*clr is int value for pixel;
*pX is player's x coordinate
*bgx is the backgrounds location relative to the player or (0,0)
*pY is player's y coordinate


How it works:
You have a background Image that is a picture of the landscape your going to be playing on, Then you have a near identical picture that is all the collide-able spots on the level colored red. clr is the pixel at the players location (shifted to a side of the player [u/d/l/r]). If that pixel the player is touching is -65536 (the color red) than the player cannot move any further in that direction.

There are no comments for this entry.
Latest Posts
eBay Lies
spinal Fri 23:44
Shoutbox Topic - 968
dna Fri 19:42
Progress / Location Bars
dna Fri 17:25
Development via GUI
JL235 Fri 07:59
Meh
Afr0 Fri 04:13
Randomly distributed coordinates...
Afr0 Fri 00:20
Mog-Dog II : Electric Boogaloo
steve_ancell Thu 17:26
Matthew Smith making a comeback?...
steve_ancell Thu 03:59
Wrong Partition!!!!?
spinal Thu 03:28
Shapes
spinal Wed 12:21
More

Latest Items
News : Newsletter #176
Jayenkai Fri 04:07
News : Newsletter #175
Dabz Tue 09:38
Blog : Snow: More Material Junk
Cower Sat 23:17
Dev-Diary : Mutant Monty: Amstrad CPC to Windows conversion
rockford Fri 13:14
Techy : AppleTV
Jayenkai Thu 09:40
Blog : Graphviz
steve_ancell Sat 14:17
Pets : Top-Down Shadow Hack
Jayenkai Tue 05:52
Snippet : JNKrunch v1.0
Jayenkai Sat 07:20
News : Newsletter #173
waroffice Fri 04:47
Blog : Material Loading
Cower Fri 02:08
Pets : I Done Won A Thing
shroom_monk Sun 11:31
Pets : Repurposing A Lexer
Cower Mon 22:06
Bah : Feeling a Little Angry
spinal Mon 11:26
News : Newsletter #170
Dabz Sat 00:34
Showcase : sbfgen
Cower Sat 16:57
More

Who's Online
Dabz
Sat, at 01:08
shroom_monk
Sat, at 00:47
Mog
Sat, at 00:18
spinal
Fri, at 23:44
blanko1324
Fri, at 21:51
Cower
Fri, at 21:33
dna
Fri, at 20:39
HoboBen
Fri, at 20:19
CodersRule
Fri, at 18:57
9572AD
Fri, at 18:29
Link to this page
Site : Jayenkai 2006-Infinity |
MudChat's origins, BBCode's former life, Image Scaler.