Game Development Community

Help with invisible walls needed

by Jesse P · in Artist Corner · 10/21/2007 (10:25 am) · 4 replies

I need to know step by step how to make an invisible wall in torque. I've tried adding null texture to a box in both milkshape as a .dts and in the constructor as .dif but no luck, the pink texture just shows up in the game. I've set up some items for looks to block the player but he can still jump over them no problem and I need to make an invisible wall to stop him. I've gone though the forums and haven't had any luck from the suggestions listed and really need some step by step help. Thanks in advance

#1
10/22/2007 (12:14 pm)
Try creating a transparent texture.

You'll need Adobe Photoshop, Corel PaintShop Pro, the GIMP, Paint.NET, or another image editing program that lets you use layers and the alpha channel, and that lets you save in GIF, JPG or PNG format.

Photoshop is the most expensive one, and it's worth every penny. It's the standard against which all other image editing programs are judged.
PaintShop Pro was free once upon a time, but now it costs money. For your gaming needs, it's as good as Photoshop.
The GIMP is free and open source. It works as well as the other two. Some people like its modular and extensible design more than the static designs of the other two. (Okay, they're not really static, but how many people really use the add-ons for PS and PSPro?)
Paint.NET (pronounced "paint dot net") is the newest of the bunch. It's also free. Users and reviewers say it works as well as the other three. Note that this is NOT the "Paint" program that you find in the Start-->Accessories menu. It's a totally different animal.

Now, if you were using PaintShop Pro, here are the steps you would use. You would do something similar if you were using one of the other packages.
1. Create a new, 64 x 64 image. (It doesn't really matter what size it is, as long as both L and W are powers of 2.)
2. Right-click on the Background layer in the Layers list, (it should be the only layer listed) and promote it to a full layer. You have to do this because PSPro doesn't let you make transparent background layers.
3. Select the image window, then press Ctl-A to select all, and press Del to delete everything in the layer. You should see a grey-and-white checkerboard pattern. The checkerboard isn't really there; it's just PSPro's way of telling you that you have a completely blank image. Transparent. Invisible. Nothing there.
4. Save the image as "transparent.png" (or jpg or gif). Your program will say something like "Warning! If you save this image as a PNG, I'll have to smash it all into one layer." Click on the "Yeah, smash it, dude" button.

You can use this texture to create DTS models in Milkshape. It should work fine creating a DIF in Constructor as well. I used a similar technique to create orange barrier fence fabric as DTS in a ski resort, and latticework windows in a palace as DIF in Constructor.
#2
10/23/2007 (11:32 am)
Thanks I'll try it out, this is exactly what I need. Also how would I make it so bullets would not hit it, if the player shoots and it hits the invisible wall it may look bad, are there any suggestions on this? Thanks
#3
10/23/2007 (1:32 pm)
For that, we need to call in somebody else who's done more work with collisions in TGE. I don't remember the collision-handling code for TGE right now.

But basically, you write an onCollision script for the wall so that it only acts on the colliding object if the object is X, or alternatively doesn't act on the colliding object unless the object is Y. Something like this:
function invisiWall::onCollision( %object )
{
     if ( %object == player ) {
          sendCollision( %object );
     }
     else {
          // do nothing
     }
}

// or this:

function invisiWall::onCollision( %object )
{
     if  ( %object == bullet ) {
          // do nothing
     }
     else {
          sendCollision( %object );
     }
}
#4
10/24/2007 (8:42 am)
Looks good, I'm not the best at coding, anyone know how to implement this?