Open Source FPS

Miscellaneous Forums/Blitz Showcase/Open Source FPS

Well, it's a start. Keep what you have and work on it. It will grow into what you want eventually.

Some things I've noticed...


If Millisecs() = shoottimer1 + 5000
Well, the odds that Millisecs() is going to EQUAL shoottimer1+5000 is very, very slim. You should change that to greater than ">".

###########################################################

PointEntity badguy\entityhandle, camera
Unless you want your badguys to have the ability to instantly turn around, you should change this to something else. Maybe look into using the AlignToVector command. It has a rate# value that you can use to make your badmen turn at a more realistic rate.

###########################################################

    If Millisecs() = shoottimer1 + 5000
      badguybullet.bullet = New bullet
      PositionEntity badguybullet\entityhandle, EntityX(badguy\entityhandle), EntityY(badguy\entityhandle), EntityZ(badguy\entityhandle)
    EndIf
This routine that you are using will make your badguys shoot non-stop (once every 5 seconds, even if they aren't facing the player, or if they can even see the player). Unless you are trying to create a Robotron type of game, this will require some work. Maybe look into trying to detect if the badguys can see the player first (Linepick or Entitypick commands). Maybe throw a little randomness into there too
If Millisecs() > shoottimer1 + rnd(5000, 100000)
so that they don't shoot at a constant rate.

###########################################################

This shoottimer1 variable looks like you are using it in a way that will cause all of the badguys to shoot at the same time. Unless this is what you want, you could add a field to the badguytype that stores the time (Millisecs()) of the last time each badguy shot.
Type badguytype
	Field entityhandle
	Field state
	Field lastshottime
End Type
and then check against that
If Millisecs() > badguy\lastshottime + rnd(5000, 100000)


###########################################################

This is redundant code:
    If EntityX(badguy\entityhandle) <= badguyX ;position of badguy at the start of the game
      TranslateEntity badguy\entityhandle, 1,0,0
      If Millisecs() = shoottimer1 + 5000
      badguybullet.bullet = New bullet
      PositionEntity badguybullet\entityhandle, EntityX(badguy\entityhandle), EntityY(badguy\entityhandle), EntityZ(badguy\entityhandle)
      EndIf
    ElseIf EntityX(badguy\entityhandle) >= badguyX + 200
      TranslateEntity badguy\entityhandle, -1,0,0
      If Millisecs() = shoottimer1 + 5000
      badguybullet.bullet = New bullet
      PositionEntity badguybullet\entityhandle, EntityX(badguy\entityhandle), EntityY(badguy\entityhandle), EntityZ(badguy\entityhandle)
      EndIf
    EndIf
There's no need to have the same 'shooting' code twice. Since the 'shooting code' is seperate from the 'walking code' it could be optimized like so:
  ElseIf badguy\state = 2 ;guard
    If EntityX(badguy\entityhandle) <= badguyX ;position of badguy at the start of the game
      TranslateEntity badguy\entityhandle, 1,0,0
    ElseIf EntityX(badguy\entityhandle) >= badguyX + 200
      TranslateEntity badguy\entityhandle, -1,0,0
    EndIf
    If Millisecs() > badguy\lastshottime + rnd(5000, 100000)
      badguybullet.bullet = New bullet
      PositionEntity badguybullet\entityhandle, EntityX(badguy\entityhandle), EntityY(badguy\entityhandle), EntityZ(badguy\entityhandle)
    EndIf
The above code does cause the badguy to 'turn around' and walk the opposite way if he goes too far left or right, BUT it fails to actually move the badguy when he's in between those two limits. One solution could be to create a substate to your guarding state that keeps track of which direction the badguy was last traveling.
badguytype
	Field entityhandle
	Field state
	Field substate
	Field lastshottime
End Type
and then rewrite it like this:
  ElseIf badguy\state = 2 ;guard
    If EntityX(badguy\entityhandle) <= badguyX ;position of badguy at the start of the game
      badguy\substate = 1  ;walk right
    ElseIf EntityX(badguy\entityhandle) >= badguyX + 200
      badguy\substate = -1  ;walk left
    EndIf
    TranslateEntity badguy\entityhandle, badguy\substate,0,0


###########################################################

By the way, this statement you made:
AND I KNOW THE ENTITYTEXTURE COMMAND!!!!!!!! This isn't the "forst" time! Most kids don't have a clue what the word "entity" means.
sounds very cocky. If you want help in the future, I suggest you try to act more polite. No one here knows what you do or do not know, so don't shout at them for it. I have attempted to help you a lot in the past few weeks (even today), but I may change my mind about helping you if you choose to act like a snotty nose kid.