Warning
Available only after version 0.5 release candidate 4
On some complex cabinets should be useful to position the player in a proper position to play a game. This example and guide will help you (as a Cabinet Artist) to position the player in a place to play a game when the game starts, and to recover the original position when it ends.
To do this, you will need to create three AGEBasic programs and register them in cabinet’s description.yaml
file.
remember to delete the
debug
entry on cabinet distribution.
Create a component to establish the player position
The idea is to use a component in the cabinet to design the player’s position, could be made in Blender
The cube in the image is located where the player head should be when the game starts. Name it as you wish, for example “head”.
Export the model of your cabinet as glb
.
On load
During the onload
phase we will register the position of the head so we can use it later
Note
Remember: all program’s cabinets uses the same
variable
space. You can access a variable defined in another program.
In lines 20 and 40 the program find the part number for the head
and the screen
components. In line 60 the program gets the head position in 3D space. Both variables will be useful in the next programs.
The program disable the head (so the player can’t see the head box).
Insert coin
The next stage is the insert coin, the program will run when the user insert a coin on the cabinet. The program will change the player height (previously it storage the actual value in the variable playerH
) by the same height of the head
component (headH
on the onload.bas
). After that in line 90 and 100 the program moves the player to the same X
and Z
coordinates than the head
to position the player on the desired place.
In line 110 the program forces the player to look to the direction of the screen.
On leave
When the player leaves the program will recover the player position and height stored during the insert coin event.