I’ve been trying to create a Paper2D game for learning purposes and I’ve had plenty of problems lately going through all this.
The level starts with one character in the world. This character can create another character when certain key is pressed. Now, the created character lives 5 seconds. After this character is dead, I’d want to switch possession back to previous character. Do you have any ideas how I should do it?
Right now I have done the following:
One of the players is defaultpawn and possessed in the constructor of its’ class. The second player (the one that lasts for 5 seconds) is possessed whenever it’s created (I used constructor again). Now how to get back to the first player. That is the question.
I was wondering that I should do it through my gamemode .cpp file. But I’m clueless now. This raised another bunch of questions - should I define and initialize new player for every level? right now I have added a class to level in UE4 Editor, but should I add this class to level in code instead for better control?
This is how my gamemode .cpp file looks like, nothing much though…
I probably have more questions, but I would have to think about it…
Thanks in advance!