0
Answered

Moving player to object

Oliver Marshall 1 week ago in Game Creator updated by Marti (Lead Developer) 1 week ago 1

Is there an Action or Custom Action that would easily allow me to move the player to an object?

I want to create a set of actions that will load a new scene, and move a player to a certain object within that scene.  I see I can move them to a position within the new scene (more or less, doesn't appear to work at the moment) but I'd like to be able to drop in spawn points within rooms to easily allow the player to appear in certain places. 

Anyone know a way of doing it with GC actions?

2D if it helps but I can't see that it will make a difference here (I have the 2D trigger working).

Olly

Unity version:
Game Creator version:
Answered

Hi Oliver!

To move the character to a certain object you can use the Move Character To Action. This will take care of playing the right animation and even use the NavMesh if there is one (you'll also check the Player's "Use Navmesh" option in the Inspector.

As for having different spawn points, it's really easy! You can make use of a List Variable. This are like Local Variables but contain an array of values. Create a bunch of Empty Game Objects in your scene and call them "Spawn_1", Spawn_2" and "Spawn_3". Now create a List Variable object and create 3 slots. Drop the Spawn_x objects each into a slot.


In a "On Start" Trigger you can use the Teleport action to instantily move a character to a selected position. you can choose the "target destination" as  List Variable and select a random slot, which will result in teleporting the Player in a random Spawn point.


Hope this helps. Cheers!