Chris Didier

We are going to learn how to get outputs out of functions in C++. This will help us simplify our code and implement our pseudo code.

  • Expression — Fragment of code that produces a value
  • Statement — An action to be performed

An expression is almost always a statement.

A statement does not always give a value.

Expressions = MyVector, LocalVector.Z, LocalVector.Z + 100, GetActorLocation().

We are going to get our current location.

We took our current location of our actor and added 1 to it each frame. We are then saying that our setting our new location each from +1 in the X direction.

--

--

Pseudo code is often written with comments.

  • Pseudo Code- Plain language description of the steps in an algorithm
  • Comments — Code that is ignored by the compiler.
  • To write a comment type // and your text will go green.

This is how we write comments. We are going to be implementing these comments as actual code next!

--

--

We are going to work with locals in a given function. We can set our values then the ones stored in MyVector.

We have been dealing with variables belonging to a class so far.

  • Scope-How long does a variable live?
  • Generally between {}

SetLocalVector from MyVector

Then SetActorLocation from LocalVector

--

--

We are going to implement moving platforms using the game loop and how tick function is related to it. If you have used Unity the update function is the tick function.

  • Process Input
  • Update game state
  • Render to Display
  • Frame — single picture in a video
  • Frame Rate- how many frames per second (FPS)
  • Tick-Called every frame

For this we are going to remove SetActorLocation from our BeginPlay and put it under our Tick function. Now everyframe we will be putting the actor in the same place every time, but if we tell it to move a direction every frame it will move in that direction.

--

--