First Person Shooter question

Blitz3D Forums/Blitz3D Beginners Area/First Person Shooter question

Bullets. Easy as pie. No math involved - unless you wanna get complicated. Which I suppose you don't want to do.

Do you know how to use types and sprites? If so, then I can help with the bullets.

If you're using types and sprites, put this code at the top, where all your types are:
Type hole
    Field entity
    Field alpha#
End Type


Then, just put this in your main loop:
If MouseHit(1)
    ammo = ammo - 1 ;subtract ammo (optional)
    h.hole = New hole
    shoot = CameraPick(camera, 400,300)
    h\entity = CopyEntity(bulletholesprite)
    h\alpha# = 0.9
    EntityAlpha h\entity, h\alpha
    PositionEntity h\entity, PickedX(), PickedY(), PickedZ()
EndIf


That will create a bullet. If you want sparks flying out, that's another question - to do with particle engines, etc.

Then, to complete the process, and to optimize speed, you might want to fade out the sprite, so it isn't there all the time. To fade out, just do this:
For a.hole = Each hole
    a\alpha = a\alpha - 0.02
    EntityAlpha a\entity, a\alpha
    If a\alpha <= 0
        FreeEntity a\entity
        Delete a
    EndIf
Next


For gravity, you could use a physics engine if you want to get complicated, which you shouldn't. Or, you could simply put this after "Flip" in your main loop.
TranslateEntity camera, 0, -1, 0


To walk up steps, you could use "EntityRadius" to create a collision radius around your camera. If you have any further questions, feel free to e-mail me.