Containers help

This forum is currently in read-only mode.
From the Asset Store
Game with complete Source-Code (Construct 3 / .c3p) + HTML5 Exported.
  • I recall some discussion a while back about how to use containers, but I didn't quite get it. If I remember correctly it was something about attaching a turret to a tank with containers, and the whole thing moves as one.

    What I want to do now is somewhat similar.

    I've made an enemy that uses the new Platform movement features (thanks Ash ), and I have the basic, blank collider box moving around, jumping, and behaving properly. Multiple instances of this enemy act independently of each other. What I want to do is attach a sprite to each instance of the collider box. So, the box would control the movement and collisions, and the sprite is just there to make it look pretty (but still has to change animation for the appropriate action the box is doing, i.e. jumping).

    Is there a way to do this with Containers? And how exactly does one use containers? And if I'm completely on the wrong track, feel free to offer up any ideas on how to achieve this otherwise.

  • Try Construct 3

    Develop games in your browser. Powerful, performant & highly capable.

    Try Now Construct 3 users don't see these ads
  • Containers don't actually affect any object's position. They simply affect the way they are picked by conditions in events. If any object is picked by an event, the rest of the objects in its container are also picked. This still makes them really useful for stuff like this though.

    If we call your collider box the collider object and the look-pretty sprite the enemy, you can place the collider and enemy in a container with each other. (all you need to do is select one and add the other to its container in properties, they are both now contained)

    Make sure you have an equal number of instances of collider and enemy. The event 'Always - set enemy to position of collider' will naturally match up each enemy to its contained collider.

    Now you can go off making your events... anything like 'Collider collides with solid - set Enemy animation to Stopped' will affect only the associated Enemy, not all enemies like you'd expect normally. That's the magic of containers

  • Awesome, thank you! Worked like a charm.

    By the way, the project this is for is being submitted to the Random Video Game Name Generator contest currently going on at TIGSource. It's just about done.

    I'm thinking about mentioning I made it with Construct, as that might drum up a few users. (It doesn't use any of the fancy shader effects and looks decidedly old-school though, so maybe I shouldn't. It might give people the wrong impression of the power of Construct.)

    Regardless, I'll be sure and post a thread when this is complete. The contest ends the 24th, so I have to hustle.

Jump to:
Active Users
There are 1 visitors browsing this topic (0 users and 1 guests)