----------------------------------- JSBN Mon Mar 03, 2003 6:40 am Changing detections (ugly stuff) ----------------------------------- ok... I am making game, where there are buildings. now there will be a detection (surface) covering the tops of the building. as the game progresses, things will explode(dont ask). these exlosions need to be able to change to the surface. any ideas how this can be accomplished? :cry: ----------------------------------- Dan Mon Mar 03, 2003 7:20 am hummm ----------------------------------- i hode use pic's. have one pic as the noraml looking surface and another as a blone up one. use serale pics like this and some if's to chage them. not 100% shure what your going for here, hope that helped. and rember we are moving to compsci.ca very soon!!! ----------------------------------- Asok Wed Mar 05, 2003 6:59 pm ----------------------------------- JSBN, u may as well tell them so they can visualise what you're working on hehe. James is making a version of Worms in turing, (if you haven't played it I highly reccomend worms armeggeddon) anyways the terrain (series of pictures) reacts to the weapons of the worms and actually makes large craters within the picture. This allready works, the problem is collision detection on deformable terrain. jeez James, u gotta be more strait up when ya want help ;) ----------------------------------- Catalyst Tue Mar 11, 2003 11:10 am re ----------------------------------- you could use an array for collision detection. U could have the whole screen as as an array (maxx by maxy) thne when a pixel is occupied set it to one (or ne other value) then use this for ur collision detection, using this u could change it terrain easily ----------------------------------- Asok Tue Mar 11, 2003 11:21 am ----------------------------------- That could work, so you can have craters respond like craters because it's pixel by pixel. Actually I think it could just be an array of booleans, land zones are set to true, air/atmosphere/craters are set to false. Then you could even add jumping now because the air is considered movable and since your doing it pixel by pixel, if you get one of those floating in the void blocks of land (remember it's worms) the land that's above you will react as non-movable terrain because it's set to true, so when you jump it would stop you, just like in the game! JSBN, You have a massive task ahead of you. Good Luck! ----------------------------------- Tony Tue Mar 11, 2003 12:06 pm ----------------------------------- setting whole screen as a 2D boolean array seems like a good idea. All you have to do is write an algorythm for explosions where a circle of sertain diameter (based on the weapon) would turn to false (or true, w/e the case). I'm not sure how to go about doing it... maybe have 2 forloops running to check the area in a square near explosion and if current pixel is incide the circle (its distance from center is less then radius) then it turns false/true ----------------------------------- Catalyst Tue Mar 11, 2003 8:32 pm re ----------------------------------- if u use and integer array u can store multiple states, so u can have more than 2 types of gorund, u can have air,destructible,indestructible, etc. ----------------------------------- Tony Tue Mar 11, 2003 8:42 pm ----------------------------------- I suppose you can just store the pixel color instead and have sertain ranges represent sertain properties... such as blue is for air if you use boolean, you just gonna end up with 2 colors, BUT its much smaller in size and you gain speed advantage. ----------------------------------- Asok Tue Mar 11, 2003 9:54 pm ----------------------------------- I don't see why color needs to be involved in this array. The boolean array will basically state is it land or is it air. As the land blows up, those memory locations are set to air (false/whatever) That way the map can consist of any thing so he doesn't have to reprogram the pixel array per map(well not entirely, you'll still have to say what is land and what is air on loading a new map) ----------------------------------- Catalyst Tue Mar 11, 2003 9:54 pm re ----------------------------------- the color has nothing to do with the collision and thats the point, so he can use pics or what ever he wants as objects ----------------------------------- Tony Tue Mar 11, 2003 10:50 pm ----------------------------------- well how are you going to draw your map? I suppose you can just have a background image with air pixels drawn over. ----------------------------------- Catalyst Tue Mar 11, 2003 11:38 pm re ----------------------------------- for the back u could just lift the coors off a two (or more) toned pic then load them into an array (or file) ----------------------------------- Asok Wed Mar 12, 2003 12:13 am ----------------------------------- The way the image currently works is the background is static and when it blows up the craters are drawn over it with the same color as the background giving it the correct appearance. This is probably the easiest way to do it graphically. ----------------------------------- Tony Wed Mar 12, 2003 12:18 am ----------------------------------- thats just what I said few posts back :D and its probably the best way since you dont take up memory storing the picture in an array :!: