Computer Science Canada

Changing detections (ugly stuff)

Author:  JSBN [ Mon Mar 03, 2003 6:40 am ]
Post subject:  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? Crying or Very sad

Author:  Dan [ Mon Mar 03, 2003 7:20 am ]
Post subject:  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!!!

Author:  Asok [ Wed Mar 05, 2003 6:59 pm ]
Post subject: 

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 Wink

Author:  Catalyst [ Tue Mar 11, 2003 11:10 am ]
Post subject:  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

Author:  Asok [ Tue Mar 11, 2003 11:21 am ]
Post subject: 

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!

Author:  Tony [ Tue Mar 11, 2003 12:06 pm ]
Post subject: 

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

Author:  Catalyst [ Tue Mar 11, 2003 8:32 pm ]
Post subject:  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.

Author:  Tony [ Tue Mar 11, 2003 8:42 pm ]
Post subject: 

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.

Author:  Asok [ Tue Mar 11, 2003 9:54 pm ]
Post subject: 

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)

Author:  Catalyst [ Tue Mar 11, 2003 9:54 pm ]
Post subject:  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

Author:  Tony [ Tue Mar 11, 2003 10:50 pm ]
Post subject: 

well how are you going to draw your map?

I suppose you can just have a background image with air pixels drawn over.

Author:  Catalyst [ Tue Mar 11, 2003 11:38 pm ]
Post subject:  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)

Author:  Asok [ Wed Mar 12, 2003 12:13 am ]
Post subject: 

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.

Author:  Tony [ Wed Mar 12, 2003 12:18 am ]
Post subject: 

thats just what I said few posts back Very Happy

and its probably the best way since you dont take up memory storing the picture in an array Exclamation


: