Programming Workshop

Pseudocode- Creating Movement

function update_movement(delta_time)

if (w_key_is_pressed)

speed_y = SPEED

if (speed_x == 0)

facing = up

else if (s_key_is_pressed)

speed_y = SPEED

if (speed_x == 0)

facing = down

if (d_key_is_pressed)

Examples of Flowcharts

Image result for flowchart symbols meaning

Image result for game flowchart examplesThis flowchart shows how Super Mario Bros works from the start of the level. This is done by a large sequence of processes that make the movement of Mario and what happens when certain buttons/movements are pressed and what consequences they bring. An example of this is when the player presses the “R” button, making Mario jump, this can either make Mario land on a platform and the sequence continues till either the Player lands back on the ground or they land on other platforms.

Below is my own example of a flow chart with basic data and movement for a 2D platformer of a character. I used Draw.io to create it as they already have the templates for the boxes for me to use, making it easier and quicker for me to create a flowchart.

My Flowchart

Instantiation

What is instantiation?

instantiation is the creation of a real instance of an abstraction or template such as a class of objects. Instantiation is one of the most important mechanisms for code we reuse in object-oriented programming languages.

day 17

Problems with programming

  • The private float needed to be changed to a private int, so the game could run.
  • There was a minus before the equals sign for some reason.
  • Invisible walls in the scene to stop the player from moving around the scene.
  • Sprite is missing for pickup.
  • Pickup value was at zero so it was not showing anything new.
  • Incorrect tag for the player because the tag had a capital P instead of an lower case P.
  • Minus score, everything you pick something up you get a minus point instead of a plus.
  • In the code the throwing power is set to zero so the player cannot throw the axe.

Properties

What are properties?

  • A flexible way to read an write a variable.
  • can be read or write only. Protecting attributes like player xp or health.

Coroutine

What is coroutine?

A coroutine is a function that works as a state machine, and for each state the coroutine behaves differently. You can see the coroutine as a collection of multiple routines that share the same code, and are linked by a state machine.

  • “wait here until complete”
  • move to next line after true/false.

UML (Unified Modeling Language)

What is UML?

A class diagram in the Unified Modeling Language is a type of static structure diagram that describes the structure of a system by showing the system’s classes, their attributes, operations, and the relationships among objects.

Why do we use it?

We use UML diagrams to plan out what variables we need for our characters and different things in our game.

I have made my own example of a UML diagram below.

UML diagram

 

 

 

Create a free website or blog at WordPress.com.

Up ↑

Design a site like this with WordPress.com
Get started