Game Development Reference
In-Depth Information
tion for this node should be Touch 1 index , as the game will not need more than
one touch. Based on the state, I would like to set a custom Boolean variable
named Touched and set its value to match the touch state. Then, you can add a
Gate node to control the execution of the following procedurals based on the
touch state ( Pressed or Released ) by connecting the two cases with the Open
gate and the Close gate execution sockets. Finally, you can set the actor location
and set it to use the Self actor as its target (which is the platform actor/blue-
print) to change the platform location based on touches. Defining the New Loca-
tion value is the next chunk of the logic:
Actor location : Using a Make Vector node, you can construct a new point posi-
tion in the world made of X, Y, and Z coordinates. As the y axis will be the hori-
zontal position, which will be based on the player's touch, only this needs to be
changed over time. However, the X and Z positions will stay the same all the
time, as the platform will never move vertically or in depth. The new vector posi-
tion will be based on the touch phase. If the player is pressing, then the position
should be matching the touch input position. However, if the players are not
pressing, then the position should be the same as the last point the player had
pressed. I managed to make a float variable named horizontalAxis ; this variable
will hold the correct Y position to be added to the Make Vector node. If the play-
er is pressing the screen, then you need to get the finger press position by return-
ing Impact Point by Break Hit Result via a Get Hit Result Under Finger By
Channel node from the current active player. However, if the player is not touch-
ing the screen, then the horizontalAxis variable should stay the same as the last-
know location for the Self actor. Then, it will set as it is into the Make Vector Y
position value:
Search WWH ::




Custom Search