Post

 Resources 

Console


I have even a faster way Spaghetti (1 reply, 0 views) (2000-Jul-30)
-
There is even a faster way 1. Create a mask of your player (Just 2 Colors. Black being seethrough) 2. Create an array for your mask ie. PlayerCol(200,200) as Boolean 3. Then when the game loads create a loop that reads each pixel of your mask and if that pixel is black set the PlayerCol(irx,iry) = False an if its not black make the PlayerCol(irx,iry) = True. 4. Then to check for a perfect collision just check the the PlayerCol(irx,iry) if its equals true and ScreenCol(Player.X + irx, Player.Y + iry) = true then there is a collision. This is much faster than check the pixel colors during runtime as instead of loading say the 200x200 = 400 000 x colors = 10 240 000 (256 Colours) = 640 000 000 (16 000 Colours) my way = 200x200 = 400 000 x player/nothing (the boolean value) = 800 000 Plus you dont need to lock and unlock the surface each game loop. This is on the same lines as how I have redone the new code for Magic Dust 2 which will be available to download some time in the coming month. The collision detection is perfect and fast (more than 120 objects on screen with pixel perfect collision for all of them running at 60 FPS with MP3 playing in background !! on a Celeron 466 with 64MB RAM & TNT Vanta 16MB) Check out my web page for more info at www.magicdust.ipfox.com <a href="http://www.magicdust.ipfox.com">Take me there now..</a>


-
Up One Level | Back to Forum

Hmm, I've got something to add on that Almar Joling (0 replies) (2000-Jul-30)

Copyright © 2002 - 2004 Eric Coleman, Peter Kuchnio , et. al.
There have been 20 visitors within the last 20 minutes
RSS News Feed