pandabear7413's Forum Posts

  • I'm trying to import this image as a sprite strip to create an animation, using the settings below. However, C3 sets a different centerpoint on each row, so every 8 frames the animation jumps a bit. I'm guessing it's because the images don't have defined edges, but any suggestions on how to import it more consistently without having to define different origins for every 8 frames?

  • Thanks for the example and the explanation! It works, and very easy. Gotta see what else tween can do for me...

  • When enemy sprites are created I want them to fade in. When they are killed I want them to fade out and be destroyed.

    I'm using the logic below, but seeing the following behavior:

    - when I press 'i', the sprite instantly appears but doesn't fade in - why not?

    - if I press 'o' within 2 seconds of pressing 'i', the sprite fades out and is destroyed - this is what I would expect

    - if I press 'o' more than 2 seconds after pressing 'i', the sprite instantly disappears and is destroyed - why is it not fading out?

    I'm obviously not understanding how to use fade properly, can someone clarify this for me, and/or let me know how to do what I'm trying to accomplish?

    Thanks

  • I have long animations where there are sometimes duplicate frames, and I want to make sure my game doesn't get too big.. Does C3 have built-in efficiency logic/features to deal with this? E.g., creating a single image in its database and reference this image from the duplicate frames.

    Thanks

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • Thanks! I made the change and it worked. I also noticed that in the underlying code, setting the initial value to "" results in:

    "initialValue": "\"\""

    but not setting any initial value results in:

    "initialValue": "",

    Good to know :)

  • I have a string instance variable in my family of objects that is originally set to "". I want to do something when it's not "". But my condition [variable not equal to ""] returns true even if the string is "" (and it's showing as "" in the debugger). I had similar issues in the past and got around it using the condition [variable > ""] but that's not working this time. Is there a better way to check if a string is an empty string? Should I not be setting it to "" in the beginning?

    Thanks

  • Working on a karate platformer, think Kung Fu Master where multiple enemies are approaching the player from both sides.

    I want the enemies to block me from moving past them. I tried implementing this by adding solid behavior to both player and enemy objects, but this caused multiple enemies to 'stack up' behind each other, with the closest to the player essentially blocking the enemies behind them from attacking. If I add solid behavior just to the player, the player pushes all the enemies around. I like how things are working without the solid behavior, but I want to add the logic to prevent the player from moving past an enemy.

    I have to think this has been implemented many times in the past, can someone offer guidance on what has worked well before I cobble up a sub-par solution of my own?

    Thanks

  • Both worked - thanks!

  • I have a family of sprite objects called enemies, with different sprite object types (zombie, werewolf). I want to create a function called spawnEnemy(string enemyType) that creates a new instance of the enemyType passed (zombie, werewolf, or random if nothing is specified), after which I want to set some common instance variables.

    My logic looks like this:

    The issue is the bottom section (starting with setPlatformDisabled) seems to run for all existing enemies, but I just want it to run for the enemy created above. What should I be doing differently? FYI I also tried capturing and using the UID like this but it didn't help:

  • Thanks for the guidance here! Turns out the issue was because multiple hitboxes were spawned during a kick, which is triggered on an animation frame. I used the "trigger once" condition to fix that. I also then used 'overlapping' instead of 'on collision' and it works smoothly. Here's the logic that's working for me in case anyone is interested.

  • The one closest to the player probably makes the most sense.

  • Working on a karate platformer, think Kung Fu Master where multiple enemies are approaching the player from both sides...

    When my player kicks, I spawn hitBox sprite overlapping the player's leg, with a 1-frame animation with speed of 60. My logic is:

    - when enemies(family) on collision with hitbox

    - kill enemy

    - destroy hitbox

    I want the kick to only hit one enemy, even if the kick animation and its collision polygon collides with multiple enemies (e.g., when multiple enemies overlap). However it kills all enemies that collide with the hitbox. I even moved the logic to a subevent with a 'trigger once' condition but with the same result.

    Any suggestions on how to make this work, or better logic given the situation?

    Thanks

  • So maybe I'm just not understanding how initial value of instance variables work!?!

    I cracked open the archived layout.json files and pulled the i.v. values I had been using, so I'm good there (I had lots of specific cryptic values I wouldn't be able to remember).

    More importantly, I was assuming that the "initial value" operated like a "default value", meaning that value would be inherited by the corresponding i.v. of any object in the family when created. Instead it seems like C3 has a different, rather confusing way of inheriting values, and the initial values are specific to the object instance. This post goes into detail:

    construct.net/en/forum/construct-3/how-do-i-8/instance-variable-initial-139702

    Looks like others have been confused by this concept before, I haven't seen it called out in the documentation so an explanation in the docs "instance variable" section would probably be helpful to other newbies like me.

  • See edit below, but this was my original problem...

    I have a family of enemy objects called 'enemies'. Enemy objects are sprites, and I have 2 different enemy types in the enemies family, a zombie and a werewolf. The enemies family has an instance variable called health, and I want to set the default value to 2.

    If I edit the family instance variables, the health IV shows 'varies', even though I have no instances of the enemies objects in any of my layouts. If I try to set it to 2, when I hit enter it goes back to showing 'varies'. If I add a zombie or a Werewolf to my layout, they have a health of 1. If I change their health to 2 and then add another of the same enemy type, the new enemy has a health of 2. But if I delete all instances of that enemy type and then add a new one, its health is set to 1.

    Edit:

    OK, so now I'm REALLY tripping out! I just saved my project, reloaded C3 in my browser, and reloaded my project, and now all family instance variables are set to 0 / blank strings and I can't change their default values!!! If I create a new i.v. I can set it's value properly, but I can't set values for any of the existing i.v.'s. Man I hope someone knows how to fix this and I don't have a corrupted project.

  • I have an audio object, and it is set to play a specific sound based on the game situation. How can I determine what sound / sound file is being played at any given point?