Constructicon1985's Forum Posts

  • 10 posts
  • oosyrag Thanks for the link!

  • Auto picking by newly created objects isn't preserved in a separate same-level event afaik

    I had no idea about that rule. Is there someplace in the manual or a blog that outlines some of these finer details of picking?

    As you said, as soon as I nested the the mirrored condition and Set Flipped action underneath then I didn't need the pick last created.

    But still, the function worked without being nested. Do the picking rules change for Functions maybe?

  • I randomly found a quirk when I was switching an existing function to be a Custom Action. The game is a 2D shooter with the player able to face either left or right and fire projectiles along the horizontal plane.

    The events pictured above, named "spawn_Projectile", both do the exact same thing: spawn a bullet sprite "Dart_Default" on the image point of a weapon sprite, set a damage variable, and then check to see if the Player is mirrored, and mirror the bullet accordingly. The code worked perfectly fine when it was originally inside a function.

    The funny thing is that when I first copied the code from the Function to the Custom Action I got a bug. If the player fires a bullet in the non-mirrored direction (right), then turns and fires a second bullet in the mirrored direction (left), and the first bullet is still on the screen, then the isMirrored toggle will apply to BOTH projectiles, the one just spawned from the barrel of the gun and the one still in flight.

    It caused some pretty cook telekinetic like visuals, where I can instantly change the direction of bullets mid-flight by shooting in the opposite direction and have a whole swarm of bullets bouncing back and forth across the screen.

    Still I had to fix it, and found that adding a "Pick Last Created (Dart_Default)" solved the problem. But why? That Pick Last Created is the only difference between these two events, other than the fact that one is a custom action and one a function. Is there some Picking rule that is unique to either? Does it have to do with the fact that the dart objects were recently created within the event?

  • I see! I haven't gotten much to animation yet, I haven't even used a timeline yet. That makes sense given what I know. And point taken about basing your collisions on an animation that can change size and shape each frame. Thank you.

  • Okay, replied before I really thought about your response. You say collisions are still used without physics, but why would you need a separate base for that? Can't you still have collisions on an animation sprite? Disregarding a fighting game, or any other game where multiple precise hitboxes are critical, couldn't you just create a hit box with Constructs flexible collision geometry? I'm asking specifically in the context of the Construct engine.

  • Thanks for the feedback oosyrag!

  • I've noticed in a lot of sample games I've seen that developers use two sprite objects to represent the player and/or enemies. The "base" is generally a simple square sprite, and the "mask" is the actual character sprite with animations. They are generally pinned to each and/or put in a container together and act as one unit on the layout.

    I understand why you would want this when you are using the Physics plugin (from reading the tutorial), as it allows you to have an animated sprite with a changing shape while still maintaining a simple collision box for the physics.

    However, I still see this done even in games that aren't using Physics, such as the example game Demonaire in the construct recommended examples. Is there another purpose to this practice?

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • Thanks for the explanation!

  • Thanks guys, it sounds like maybe I'm overthinking it and should use the feature natively put there for that purpose until I find a reason not to. dop2000, by coincidence I happened to be reading a comment of yours from a few years ago where you said something like "Dictionaries have the benefit that you can cycle through them, which you can't do with Instance Variables". I would have to search around to find the exact quote, but do you remember what you were referring to and explain it? I didn't understand that statement at all.

  • Hey Everyone,

    I have a very broad question about best practices for storing enemy attributes or other sprite instance object. I am making my first game and my Family "Enemies", which contains all my various enemy object types, has gotten up to 31 attributes that I'm tracking in the Family instance-variables. I've been reading about Dictionaries, wondering if they were a better way to store all the enemy attributes and figured I should make that decision sooner rather than later. So with that in mind, I'm open to any suggestions and/or explanation, but my main questions are:

    • If I have lot of enemy types with lots of differing attributes and I have an "Enemy" Family containing all of them. Is there any reason NOT to put all the enemy attributes in the "Enemy" Instance Variables, vs using the instance variables on each individual enemy object type? Does it make a difference if many of my enemy types will use unique (or only in a small subset) attributes that won't be used at all by the other enemy types?
    • Is the Dictionary vs Instance decision based on the number of variables? At what number of variables would you switch?
    • In general, what advantages do Dictionaries offer over Instance Variables?

    Thanks for your time if you respond to this.

  • 10 posts