velocity

velocity

velocity

Details

Kode wheel segment Physics
Style Number Variable & Vector variable
Modifiers None
Primarily WHEN/DO Both
Pre-made brains that use it Unknown

Physics > velocity

Description

This tile allows you to query the speed and direction an object is travelling in. It has no modifiers but is used in conjunction with Math Vector tiles (as if they were modifiers).

Length: Measures the speed of the object (number)
Normal: Measures the direction of the object (3 numbers representing x,y,z coordinates)

 

Example Code

WHEN DO [numvar: speed][=][velocity][length]

WHEN DO [display][text:speed:][numvar:speed][screen top right]

or

WHEN DO [vector:var: direction][=][velocity][normal][screen top right]

 

Modifiers

None

Other Uses

 

Can be used to create stealth mechanics. If the player pushes the stick forward the character moves faster. You could determine that a speed under a certain number would constitute as being stealthy, and above that not. You could then query that boolean to determine the actions of an enemy (it wakes up, it turns around, it attacks, alarms go off etc).

WHEN DO [numvar: speed][=][velocity][length]

WHEN [numvar:speed][<][2] DO [boolvar:stealth][=][true]

…WHEN [else] DO [boolvar:stealth][=][false]

You could also use the direction vectors to determine whether a player is facing the correct way to create a directional system (using red and green lights for example).

Comments are closed.

Website Powered by WordPress.com.

Up ↑

%d bloggers like this: