SoldjahBoy's Forum Posts

  • You could make an overlay sprite that matches your main sprite - but colour it in whatever the tint colour is supposed to be, apply something like "overlay" or maybe "hard light" effect to it... then use LERP to adjust the opacity of the overlay object.

    That might work^

    ~Sol

  • If your project is simple, feel free to drop me a link and I can take a look at it.

    If you can reproduce the issue in a fresh capx showing only the parts of the problem (like, if your project is HUGE or you don't want to risk leaking it) then that will also work.

    It sounds definitely like a picking problem... it sounds like perhaps the catching on fire part is working, but when you're changing states of the trees to "burnt" it's picking the wrong target ID, or something.

    ~Sol

  • I'm using an angle *range*, not 16 angles.

    To get the correct angles to make something like this work, you have to know all the angles "in between" the standard 8 directional angles (The standard 8 directional angles IE; 0, 45, 90, 135, 180, 225, 270, 315)

    You need to find the point that's half way between each of those angles, to create an angle "range".

    See attached (badly drawn) diagram. Hopefully this will clear things up;

    https://www.dropbox.com/s/fvns8tk4pvdk6im/angles.png?dl=0

    So you only use 8 directions of actual animation/graphics but you change the frame or animation sequence based on a range of angle.

    As I mentioned originally, this effect looks better with objects like cars/vehicles and not-so-much for a character sprite.... but that totally depends on how you've drawn your artwork as well. You will need to experiment to see if something like this will do what you're looking for.

    ~Sol

  • You can use the tint effect for this... the trick for a smooth transition is to probably use something like LERP.

    First, apply the tint effect to your object, then choose the RGB or HEX value you want your tint to be.

    Last make an event to smoothly change the tint... something like (pseudo-code);

    On trigger

    -- Set tint value to: lerp(self/tint.value, desired(tint).value, 1-0.3^dt) - (change the 0.3 to 0.1 or even 0.01 for a super fast change or lower it to like 0.5 or even 0.99 for a slow or super slow one)

    The same will apply to go back to the other colour... just do another lerp action from the self/tint.value to the desired(no tint).value

    ~Sol

  • You can create an instance variable for your character/AI and call it something like, OldX and OldY.

    Every tick (record this value);

    Set OldX to Sprite.X

    Set OldY to Sprite.Y

    but BEFORE that event, in your list of events...

    Every tick (compare the value before it changes with event shown above)

    Compare value Sprite.X to OldX -> is not equal, do stuff

    Compare value Sprite.Y to OldY -> is not equal, do stuff

    So ultimately you'd have something like:

    Every tick

    --Compare value Sprite.X to OldX -> is not equal, do stuff

    --Compare value Sprite.Y to OldY -> is not equal, do stuff

    -----Set OldX to Sprite.X

    -----Set OldY to Sprite.Y

    Hopefully that will do the trick!

    ~Sol

  • Yeah, picking instance ID's can be tricky.

    I always create my own numbering system for every object on creation. I have things like "entCount" or "DudeCount" which I start from 0 and just add 1 each time a new thing is spawned that I need to track. This way, I have sequential numbers that are more easily (for me) tracked.

    Comparing the UID or custom ID is crucial, but you should have that all nested in a loop "for each appletree" or "for each fire", depending which way your comparison is set up. This will make sure it compares every tree independently. You can even check them in order of UID if you want, if "age" of a tree is important.

    Using instances can be tricky, especially when you have multiple instances of multiple objects all trying to interact with each other. You'll get the hang of it after experimenting around.

    ~Sol

  • Here a video of the problem

    https://youtu.be/DynhTjoRM3Q

    I dunno why, but that made me laugh xD

    I have no idea why it could be doing that, unless perhaps your collision masks are slightly crooked? Are you using a custom collision polygon or just bounding box mode set to whole sprite from the physics object options?

    *EDIT*

    I tried to download your project to check, but it's not saved as a single project file - which makes it a little hard to download properly.

    ~Sol

  • Ok, it sounds like what I'm calling "pseudo-isometric" - where the graphics are drawn from a frontal, but slightly "above" angle.

    Ok so, you have your 8 directions ( 0 degrees, 45 degrees, 90 degrees, 135 degrees, 180 degrees, and so-on) - these are the angles you actually move at, but if you go half-way in between each of these angles to make a total of 16 angles ( 0 degrees, 22.5 degrees, 45 degrees, 67.5 degrees, 90 degrees, 112.5 degrees, 135, etc etc).

    The idea is to use the 8 angles "in-between" your actual directions, AND the actual directions themselves, as a trigger for changing animations/frames. So, you rotate your sprite smoothly (360 degrees spinning, like car behaviour for example) and you use the angular measurement (range) to set the correct animation.

    Imagine using smooth turning instead of 8-directinonal movement

    -----------------------------------

    Pseudo code:

    If player.angle is between 337.5 and 22.5 (the character will be facing right within 45 degrees) -> set animation/frame to "right"

    If player.angle is between 22.51 and 67.5 -> set animation/frame to "right/down"

    If player angle is between 67.6 and 112.5 -> set animation/frame to "down"

    etc, etc

    This should give you the freedom to rotate your sprite smoothly, and it will change animation frames/angles that match your artwork.

    I'm doing something very similar to this myself actually using 8 directional movement, but I'm rotating my player around only 6 directions from a display point of view. I translated what angles I wanted to display the direction I am moving in graphically, so my "left" is the same as my "diagonally left/down" and "right" is the same as "diagonally right/down". It's kinda hard to explain, but hopefully you got something from that. I can maybe make an example or share some prototype I'm working on if you get stuck still. Cheers!

    ~Sol

  • Anytime dude

    ~Sol

  • Oh, not saying it's a bad idea at all... it all really depends on your requirements and how you want the game to work.

    If you want fire spread to be simple, then using a family will help a lot for that type of thing. The difficulties will start to arise when you're defining whatever constitutes a "new fire" from the old fire. I guess only you really know exactly what you're wanting to achieve, so the methods used can often be specific to the problem

    ~Sol

  • Ah yes well if you need that additional control over individual fires, then doing them as separate objects could prove a more flexible method

    ~Sol

  • Nah it should be super easy to add a family for burnable items.

    Just do to your project and in the right side pane, find families and right click -> add new family -> add all burnable objects to family -> name family "flammable" or something like that. Give the family some instance variables for things like "IsOnFire" or whatever is needed. These variables will reference the object only through it's family relationship and work separately to the objects actual instance variables, but the variable data can easily be transferred to the object itself.

    Now make an event:

    Fire overlapping "Flammable" (family)

    -> "Flammable" (family) "isOnFire" = false ==> Set object on Fire (set "IsOnFire"=true)

    Families are super easy to work with, and not as difficult as you perceive. The idea is to be able to affect many objects and instances of objects using one event. For another example if you had a bunch of enemies that are all different objects to each other, you can make a family called "enemy" and combine them into a single reference for say, when you shoot a bullet. Bullet collides with "enemy" then subtract health variable from whatever "enemy" the bullet hit. It saves you from haveing to make events like "bullet hits enemy 1 -> do this" then "bullet hits enemy 356 -> do this".

    ~Sol

  • No problem at all.

    I fumble through this stuff just as much as the next guy... my ideas are probably not the most efficient way to deal with things, but it certainly helps get the job done via my way of thinking and seems pretty solid.

    You can easily make the fire "spread" via a simple event "fire is overlapping X object/family" - then create events to control EXACTLY what happens when said object is on fire.

    I would probably still suggest adding all flammable objects into a family (called flammable, or burnable, etc) then use that family to do the fire "spread". From there, reference each object individually once it's "on fire, IsBurning=1, etc" and create the effects or frame/animation changes as required.

    ~Sol

  • You mention that your enemies are "clones" of each other, which is fine. Is each "clone" though, just a SINGLE enemy as the sprite or do you have like 2 or 3 enemies per sprite that act as one object?

    If each enemy is it's own individual "clone" then you simply need to use object picking nearest/furthest as mentioned by celstrider. He basically explained in a shorter way what I was talking about in my post before. Just pick the enemy that's closest to your defender, and apply the damage to that enemy only (because you picked it specifically based on it's distance to the defending player).

    I think the reason that it's damaging ALL units right now, if because it hasn't been told to pick ONE unit specifically.

    ----------------------------------

    If overlapping ENEMY

    -> deal damage to enemy

    This will cause ALL enemies to be damaged when only ONE enemy is being overlapped.

    ----------------------------------

    If overlapping enemy & distance to enemy is less than 10

    -> deal damage to enemy

    This will cause only enemies that are within 10 pixels of you to take damage.

    ----------------------------------

    If overlapping enemy

    -> pick enemy closest to player

    ---> deal damage to enemy

    This will cause only the enemy that's closest to the player/defender/arrow to take damage.

    ----------------------------------

    The key is to make sure the game knows WHICH enemy you want it to pick, otherwise it will simply pick them ALL whenever there is overlapping.

    Hopefully this helps a bit more

    ~Sol

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • No problem at all mate.

    I guess there's a few ways you could go about it... if you save to a dictionary for example, and save a file from it (essentially an XML file) then you can include these files with your game and simply read from them at runtime (basically "loading" the data into your game and creating the tiles from it). If you are going with a mobile platform then honestly I'm not sure how that would work (since I think you can only access browser storage?) - I don't make anything for mobile as you can probably tell.

    You could also export these XML "saves" from your editor on your computer... then create global variables in your game hat correspond to each level, and then literally copy and paste the entire save file contents into a global variable, then load THAT into a dictionary at runtime (so you can reference the various lines of data or call up whatever else you need).

    If you are going to do a PC release though, then yeah... totally just include your dictionary generated "save files" and load them up at runtime.

    I have made some stuff with dictionaries that combine several dictionaries into a single one... for example, Dict1 is used to save the level tiles, Dict2 is used to save the entities (player/enemies), Dict3 is used to save stats for the game (lives, score, etc), then Dict4 is used to combine Dict1,2,and 3 into a single "save file". When loading the file, it is then "unpacked" back into the 3 individual dictionaries so I can re-create the objects simply using linecount, loopindex, and a single global variable that grabs each dictionary for distribution to the object(s).

    Hopefully that makes sense.

    ~Sol