What's the best approach for this?

0 favourites
  • 7 posts
From the Asset Store
Best car suspension with spring effect and very cool terrain generation.
  • Here's the kind of thing I want to do:

    https://www.dropbox.com/s/dath57nh0v8r1fc/SlapJaw_Enemies.jpg?dl=0

    I want to make enemies that share a weak spot (or multiple weakspots), a pimple type thing in this case.

    Basically I want to be able to design, animate and code one pimple, that can be shot, destroyed etc. Then add it to multiple enemies.

    I had thought containers might be the best way to do this, but now that I read about them a little more, it seems that any events that affect one object in a container, will affect them all. This obviously wouldn't work so great for what I need to do.

    Also when I create an enemy type, it'd be nice to have the pimples already pinned on to the object in the correct position and angle.

    Not too sure where to start.

    Thoughts?

    Thanks in advance.

  • I am not sure if my suggestion is the best way but you could have image points to spawn the pimples when you spawn an enemy body. then set a variable that store the UID of the body on the pimple. then some type of condition when a pimple pops with x UID minus hit point from body of same UID. this is a possible solution.

  • Interesting. I haven't messed with UID's too much.

    Thanks for the suggestion.

  • Anyone else have any methods in mind?

    I'm keen to hear a number of approaches, so when I screw one up I have backup

  • Here's the kind of thing I want to do:

    https://www.dropbox.com/s/dath57nh0v8r1fc/SlapJaw_Enemies.jpg?dl=0

    I want to make enemies that share a weak spot (or multiple weakspots), a pimple type thing in this case.

    Basically I want to be able to design, animate and code one pimple, that can be shot, destroyed etc. Then add it to multiple enemies.

    The design and animate part is fine. For the code you probably just need a function to put the code in that can be called easily

    I had thought containers might be the best way to do this, but now that I read about them a little more, it seems that any events that affect one object in a container, will affect them all.

    Not exactly. All objects in the container will be picked, but it's up to you to do stuff with them, or not. Having said that I still don't think it's the way to go because you can't associate multiple objects of a given type, only one. Maybe look at 3rd party plugins (I'm not sure if InstanceBank is the one).

    This obviously wouldn't work so great for what I need to do.

    Also when I create an enemy type, it'd be nice to have the pimples already pinned on to the object in the correct position and angle.

    You can make this 'automatic' by using OnCreate of the enemy, and just have a Function that you call to add each pimple on an enemy.

    But the basic mechanism of storing the UID as suggested earlier is fine, or have an ID for each enemy (more useful IMO as sequential numbering can be used for other things).

  • In one of my projects, I had an object called "Keypress" that showed an image of a keyboard key to press whenever you approached certain locations/characters.

    In the layout, there were multiple instances of the Keypress sprite; each Keypress had an instance variable named "Which."

    So, related to KSLR's idea above, say for each enemy you have a pimple, and Pimple.Which is set to the name of the enemy. Whenever Pimple is hit, it calls a function with the value of Which.

    PimpleHit("Which") assigns damage wherever you're keeping track of it.

    This isn't dissimilar to using the UID, but I find that having a name makes it more human-readable.

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • Nice!

    Thanks for the suggestions.

    I'll look into all of the approaches and see what works out best.

    Appreciate the help!

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