Swap an object with another

I think an action to turn an object into another object should be added. Like: if key pressed “k” transform object “player” into object “enemy1”
This feature would be very convenient.

Hello Ninjonahplayz,
Thank you for your topic.
Could you please explain (with as much detail as possible) under which cases you’d like to have such feature?
What are the thing that you’re trying to achieve on your project?

Thanks.

A lot of times when working on my game, I want the character to become another object (powerups, etc.) so an action to do that would be very helpful. instead of having to do a ton of complicated code to achieve the same thing.

Just for reference, there’s no complicated code required to do this (nor is there any code in GDevelop, unless you meant events?).

  1. Make your other objects.
  2. Put them and the player in an object group.
  3. Use the event group in your events instead of the player. (1 change to your existing events)
  4. When you want to swap them out, just use the “Delete object” on the group name (it’ll remove any of them that are out there) and in the same event use the “box create an object by name from group” event, using the other object name you want.
1 Like

sorry, I meant in-game. and yes, I meant events.

1 Like

Thanks for the clarification. To be clear, my answer is specifically for in-game use. Those 2 actions (delete Objectgroupname and Create Object from Objectgroup) are all you need to swap if you use object groups like I mentioned.

ok, I will try that. :+1: