Weapon Switch

Blitz3D Forums/Blitz3D Programming/Weapon Switch

The forum is locked. These are the original blitzbasic.com forums, kept so they can still be read. No new topics, replies or edits can be made here. To join in, head over to the Blitz3D+ forums.

I'd store everything that is a pickup in a type collection


Type pickup
   field x,y,z
   field p_type ; the type of pickup
   field quantity ; the quantity of the pickup
End Type



Then loop through each type object and do a distance check between the player and each of the type objects. Then, if the obect is within a certain distance, check to see what kind of pickup it is. Then, depending on that, add extra ammo, or health, or add a flag saying you have picked up a gun.

What i'd do, is give you player all the guns he will ever have, but have a flag for each gun, a variable saying gun_available = 0: When switching weapons, check the flag for each gun, If the flag = 1 then, you can switch to that weapon, if not, you don't "have" it.