Playmaker Forum
PlayMaker Help & Tips => PlayMaker Help => Topic started by: Frost on June 19, 2018, 06:05:42 PM
-
Hello again PlayMaker forum! Im making a 2D platformer game where i have two characters and want to swap them when they collide with an image then they swap. I tried OnTrigger Enter 2D collisioning with a trigger tag (trigger tag) to create new object (the other player) and destroy self but doesnt work at all. Any ideas on how to do this?
-
After adding a Box Collider (Trigger checked) and a Rigidbody 2D to the trigger object (something that makes the player swap and can go across it) actually works but in unexpected way... the trigger is working and my character get destroyed. But the other character is not spawning in its place with Create Object... any ideas?
-
Ok now it seems to be working out nicely excepts that the camera is stuck where the initial character was destroyed, is like is not following the newly spawned character. Any ideas how to fix this?
-
Ok now it works but the camera is showing nothing except the player and the empty minimap... any help, please?
-
Hi.
if you need to swap regularly i think its better to use activate/deactivate instead of Create/destroy (better for performance)
Do you have the character inside a parent? (where parent does all the movement/camera follow etc.)
-
Hi djay. No im not using a parent, each character do the movement different so parenting without any idea to code would not work. I have two characters and they behave very different. When i hit the trigger my character swaps correctly and moves correcly but the camera doesnt follow him. Im stuck here...
Thanks for the activate/deactivate idea i will try that now :)
-
It's always better to post screenshots of your actions, then we don't have to guess have your setup is.
My initial thought is that you need to set the camera target to the new object?
-
create an empty. put your controls on this empty, put your two players(with animations) both in this empty. deactivate one of the players. do your trigger thing, and when it triggers, activate the other one and deactivate the current one.
-
Ok so here are my PlayMaker images of what im trying to do
Ok the images dont seem to work so here is my DropBox shared folder.
https://www.dropbox.com/sh/6mvjxu8xuj4t2v4/AACLNU6tOy4rfAckoLAjbAwja?dl=0 (https://www.dropbox.com/sh/6mvjxu8xuj4t2v4/AACLNU6tOy4rfAckoLAjbAwja?dl=0)
(https://www.dropbox.com/s/2q4dfa6c4nc7363/1.png?dl=0)
(https://www.dropbox.com/s/y31ajuieepipye2/2.png?dl=0)
(https://www.dropbox.com/s/i0er0ldl7iaudhv/3.png?dl=0)
(https://www.dropbox.com/s/t3lk16lt6manis4/4.png?dl=0)
-
Basically:
Start > Trigger Exit 2D with player > Swap > Deactivate Player 1 > Transform > Activate Player 2
The result work but the camera doesnt follow Player 2 and i dont know who to do this
-
Yes, you need to change the target in your camera script for it to follow another object/character.
If you're not sure about how to do it, have a look at this:
http://www.smalljelly.com/home/2016/7/29/playmaker-guide-get-component-get-property-set-property-with-instantiated-prefabs
-
Yes, you need to change the target in your camera script for it to follow another object/character.
If you're not sure about how to do it, have a look at this:
http://www.smalljelly.com/home/2016/7/29/playmaker-guide-get-component-get-property-set-property-with-instantiated-prefabs
Thanks for the link i will check it out as i have been struggling to do that. Time to look into prefabs