top of page
Search

BA2a - Endless Runner Base Tutorial

  • Writer: charlightart
    charlightart
  • Sep 25, 2015
  • 3 min read

Now that I have a specific idea in mind about what I want to create, it was time to follow relevant tutorials. The first and most important one being the 'Endless Runner with Blueprints' on the Unreal Engine Wiki. This would set the base for my prototype, before I add any additional mechanics and features. I may not implement all the features shown in the tutorial within my final prototype, however for now I will be copying everything which is mentioned. It would still be a great learning curve, even if I don't use the information!

I have wrote all the steps to help me figure out what is happening with my alterations, as well as for future reference. After a certain amount of steps I have tested it to check if the blueprint works.

Part 1: Movement

1. Setting the camera

Click Viewport > Change from 'FollowCamera' to 'CameraBoom' > Alter the Right side sliders > Socket Offset: Z Axis + 100

2. Making sure the character constantly runs forward

Event Graph > Delete 'inputAxis MoveForward' > Right click, type 'Tick' (Event Tick) > Drag white arrow (node) to 'Add MovementInput'.

Test 1: So far, so good! My character runs forward continuously in a straight line, and I'm also able to move right and left.

3. Turning when you reach a corner - Creating the initial Blueprint

For the 'A' key: I am firstly setting the variables so the player is able to turn, which includes altering the 'CombineRotators' Yaw (Y) to -90 (which allows the player to turn -90 to the left).

For the 'D' key: I duplicate all this information and connect it to 'D', the only change being I set the 'CombineRotators' Yaw (Y) amount to 90 (which allows the player to turn 90 to the left).

Test 2: Nothing has changed yet, same results from test 1.

4. Turning when you reach a corner - Processing the Rotation

Here I am creating a 'CustomEvent' (turning around a corner) and dragging the 'DesiredRotation' (get) variable into the scene to compare if they're equal rotations (I'm adjusting it so that they are). I can also change the speed my character turns around by altering the 'InterpSpeed'.

5. Testing the Corner Rotation - Adjusting the Movement Input

I change the 'AddMovementInput' scale value to 0 in order to check that my rotations are working efficiently. Changing the value to 0 means my character won't move continuously, meaning I don't need to worry about my character walking into a wall or falling off the level (at this early stage).

Test 3: I'm able to turn by pressing A and D, however the camera doesn't turn with the character?

Test 4 (FIXED): I was able to fix the problem in Test 3 by connecting 'True' on one of the 'Branch'es to 'SetControlRotation', as I seemed to have missed that step! Now the camera turns with the character after pressing A and D.

6. Creating the Corner Trigger

I have now added a 'Box Trigger' into my scene, which will act as a small zone where the player can turn. The collision event makes this possible.

Test 5: SUCCESS! When I press A or D while running inside the box trigger, the camera moves 90 degrees! Below I have captured screenshots of approaching the box trigger, turning slightly, turning 90 degrees and then continuously moving forward.

7. Changing how A and D process rotations

Even though the previous test was a success, my character could still rotate 90 degrees whenever I pressed A and D after hitting the box trigger. This needs to be changed as the character won't always be turning corners. I can use the 'SetCanTurn' variable to change the 'DesiredRotations' to false, which should fix this.

Test 6: Fixed! Now my character doesn't always rotate 90 degrees after running into the box trigger.

Part 2: The Course

1. Creating a Spawning Floor Tile

Firstly I have created a new blueprint in which I have added a base floor and walls. The attach point will be where new floor tiles will duplicate and spawn.

2. Creating a Spawning Floor Tile - Functions

This function links with where I have placed the attach point on the floor tile.

3. Creating a Spawning Floor Tile - Functions

Firstly I have created a new blueprint in which I have added a base floor and walls. The attach point will be where new floor tiles will duplicate and spawn.

 
 
 

Comentarios


Featured Posts
Recent Posts
bottom of page