Sorry your browser is not supported!

You are using an outdated browser that does not support modern web technologies, in order to use this site please update to a new browser.

Browsers supported include Chrome, FireFox, Safari, Opera, Internet Explorer 10+ or Microsoft Edge.

Code Snippets / [DBC/DBP] Punching holes in a cheese

Author
Message
Attila
FPSC Reloaded TGC Backer
20
Years of Service
User Offline
Joined: 17th Aug 2004
Location:
Posted: 26th Mar 2008 00:36 Edited at: 26th Mar 2008 00:37
Punch holes in a cube in realtime! Each time you click the mouse
a hole is punched in your cheese. This could be helpful in a shooter
where you want to shoot holes in a wall.

With some improvements it should be possible to shoot the holes where your weapon points. But as a proof of concept. This shows it is possible to do in DBC & DBP



Attachments

Login to view attachments
calcyman
17
Years of Service
User Offline
Joined: 31st Aug 2007
Location: The Uncertainty Principle
Posted: 5th Apr 2008 21:52
Oh, you're using a texture with transparency. Pretty good, although vertexdata would be better.

The optomist's right, The pessimist's right.
Roxas
19
Years of Service
User Offline
Joined: 11th Nov 2005
Location: http://forum.thegamecreators.com
Posted: 7th Apr 2008 15:21
I think transparent texture is better perfomance vice. Really cool idea and i would never tought making it that way

Your signature has been erased by a mod because it was too big
Lord Einstein
19
Years of Service
User Offline
Joined: 22nd Oct 2005
Location: Well here, of course...
Posted: 8th Apr 2008 16:54
Possibly try to have a different texture for each side. This would mean that your cheese would not have the same holes punched out on either side.
Attila
FPSC Reloaded TGC Backer
20
Years of Service
User Offline
Joined: 17th Aug 2004
Location:
Posted: 8th Apr 2008 20:49
Basically I developed the idea to change a doors texture in a shooter, to punch holes through a wooden door when its shot at. The way DB textures a object covers all sides with the same texture (when used in "texture object"). The snippet is only a proof of concept, but I thought it could be helpful for others.

Using vertex would limit it to DBpro, but the texture variant works on DBclassic too.
Gosub
17
Years of Service
User Offline
Joined: 23rd Sep 2007
Location:
Posted: 15th Apr 2008 10:43
Quote: "Basically I developed the idea to change a doors texture in a shooter, to punch holes through a wooden door when its shot at. The way DB textures a object covers all sides with the same texture (when used in "texture object"). The snippet is only a proof of concept, but I thought it could be helpful for others.

Using vertex would limit it to DBpro, but the texture variant works on DBclassic too"


Do you increase the accuracy with bounding or with mouse position?
Attila
FPSC Reloaded TGC Backer
20
Years of Service
User Offline
Joined: 17th Aug 2004
Location:
Posted: 20th Apr 2008 23:12
In the example the holes are positioned by random, in a game I will calculate the impacts position and the change the texture with a black circle to represent the hole at the proper position. This is simple geometry. But there is no gun in the code and therefore nothing to calculate,

The code is, to show that you can punch holes by changing a objects texture.

Look at the code in the function AddHole(), as a group of black circles creates the black (ink rgb(0,0,0),0) spot which is transparent. The position of the spot is randomized (x=rnd(),y=rnd()). The box is to fill the differences (lines) between the circles (black is transparent in DBC and DBP). And the 'get image' takes the texture with a hole which is then applied to the object using 'texture object'.

simple isn't it?

Attila
SFSW
22
Years of Service
User Offline
Joined: 9th Oct 2002
Location:
Posted: 21st Apr 2008 03:27
Code sample adapted for DBC below, just need to use the single 'set object X' command instead of labelled commands.



Attila
FPSC Reloaded TGC Backer
20
Years of Service
User Offline
Joined: 17th Aug 2004
Location:
Posted: 23rd Apr 2008 18:40
If you looked 2 lines below you would have found the same command beyond 'Activate this command for DBC' ...

Login to post a reply

Server time is: 2024-11-25 02:51:23
Your offset time is: 2024-11-25 02:51:23