TGC Codebase Backup



Muzzel Flash Effect For FPS Games by Trek

28th Feb 2005 12:55
Summary

A short demo showing how to create a muzzel flash effect while shooting a gun.



Description

The effect is created by using an extended + sign as the flash frame and setting it to remove all black from the flash texture. Then you texture it using a simple variable. BTW, to see more great code check out my website at http://roborangers.home.comcast.net/Trek.html



Code
                                    ` This code was downloaded from The Game Creators
                                    ` It is reproduced here with full permission
                                    ` http://www.thegamecreators.com
                                    
                                    sync on : sync rate 60
hide mouse
autocam off

load image "Flasha.bmp",101
load image "Flashb.bmp",102

load sound "Metal Shot.wav",1

load object "Soldier.3DS",1
position object 1,0,-1,3
yrotate object 1,270

load object "Muzzel Flash.x",2
position object 2,.93,0.35,2.8
scale object 2,.2,.2,.2
yrotate object 2,270
texture object 2,101
set object 2,1,0,0
hide object 2

time=1000

color backdrop rgb(0,0,0)

camy#=2

for n=1 to 110
camy#=camy#-.02
position camera 2,camy#,1
point camera 0,0,3
sync
next n

top:

play object 1

sync

wait 1250

flash=100

show object 2

play sound 1

for n=1 to 3

flash=flash+1 : if flash=103 then flash=101
texture object 2,flash
wait 50
sync

next n

hide object 2

set text font "Goudy Old Style"
set text size 25

yellow=rgb(200,150,0)

ink yellow,yellow

wait time

time=500

do

text 180,10,"Press any key to play animation again"
if inkey$()<>"" then goto top
sync

loop