Shooting Demo

by Rifthaven
A demo that explains a system which you can fire a gun! [More]
To download this demo for your Linux/Mac installation, enter this on your command line:

DreamDownload byond://Rifthaven.ShootingDemo##version=4

Emulator users, in the BYOND pager go to File | Open Location and enter this URL:


Version 1.4
Date added: Jul 17 2003
Last updated: Jul 29 2009
1 fan
Welcome to Rifthaven's Shooting Demo, the is a simple demo how to have a bullet fire from the usr and if it hits a turf with a density of 1, it stops, or if it his a mob (unless it is the player who fired it) it says a message and stops. THIS DOES NOT HAVE A HP OR DEATH SYSTEM, this just explains how to get a shooting system working. If you want a damage system, add it to the part where it tells the usr that he shot the mob.

If you have any questions, email me at [email protected]

Version 1.4 changes

The object that is the bullet has now been moved to be created after the check of the user's fired variable. Reason being is that it was being created every time the shoot proc was invoked, regardless if he user was ready to fire or not. This, of course, is inefficient. It has been moved so that it is only created if firing is ready.

Instead of moving the object bullet and then checking for a mob/turf, the proc now looks ahead of the bullet checking for such then moving if none are found. This is done in case one would like to modify the code to implement an explosion of sorts with the center being the bullet. Previously, the explosion (say with area of 1) would be seen on both sides of a wall (with thickness of 1). Now it could explode without actually being on the wall.

The code no longer breaks out of the loop. Previously, the while(H) served no purpose at all. Might as well been while(TRUE). Now it rightfully checks with the while loop. This is the least important change.