Gw Temp


Tutorial - 'FPS System 3: Strafing' by Dimensionwyrm

An item about RPGMaker 2000 posted on


Dimensionwyrm/Lunchman introduces part 3 to the FPS System: horizontal strafing.


NOTE: This tutorial is not exactly precise and someone reading this is expected to have quite a bit of experience and be able to understand this anyway.

Today I’m going to teach you how to add strafing to my FPS System.You’ll also have to have finished part 2. Once you have those finished, proceed to the next step.

Step 1

First of all, for strafing, you can’t use a panorama, but instead a picture. Create a picture with the dimensions 640x320 for a background. Now, in the very first event where everything is initiated (the first one made this entire series of tutorials), load up this picture at the coordinates 160x120 as picture #1 (You’ll have to raise the number for every other picture). This is the simplest part.

Step 2

Now then, because you aim with your arrow keys, the easiest and most natural way is to use Shift and the Cancel Key to strafe (So they’re right next to the spacebar, which you use to shoot, or right around the ‘z’ key, which can also be used to shoot, but you’ll have to change the key for the shield to maybe ‘/’ which is right next to the shift on the right side). So, in the event with aiming/shooting/shield add two more possible directions with their forks: the shift key and cancel key. Before going on, make a new variable: Character X Left and Character X Right. Now, at the initiation event where all pictures are placed, have it set the left variable to 120 and the right variable to 440. When the character moves left, have it lower the both variables by x(this will be however many pixels the character moves). Now move the background and enemy pictures that many pixels RIGHT. Do the opposite with the right movement.

Step 3

Now, we have to make it so that the enemy won’t hit you if it misses. To do this take the final picture when it attacks (if it hits or not). Find the distance from its center to its left side. Now make two new variables, enemy left and enemy right. Set both enemy variables to the enemy picture’s X coordinates (which is already stored in a variable). Lower the left variable by the distance from center to the left side, and increase the right variable by the same amount (in the enemy attacking part, before determining whether or not the shield is on). Now, check if the enemy’s left variable is less than the character’s left variable. If it is, then completely skip the shield part with labels (to the area immediately after) and don’t damage the hero(or if you want to be more realistic have it damage less). Do the same thing for the right side. Now, if it is in, in that case move the shield part into there for both, then jump to the label after the shield.

Optional Step

Now, you might want to make it so that the enemy doesn’t randomly move offscreen while you move around, right? So, if you want to do this, in the enemy movement area, before movement create some forks to check if the left (and right) variable is less than its counterpart for the character. If it is less then copy both variables into temporary variables and subtract the enemy’s from the character’s. If it is over a certain amount (obviously more than the enemy’s graphic’s width) then have it move differently, obviously edging toward the left/right.

Now you’re done! Next time I’m going to show you how to give the enemies projectile attacks/disjointed hitbox attacks(like a weapon) along with spells!