Dingo's Recent Forum Activity

  • His situation is a different scenario than regular pathfinding. There are no obstacle, and the only limiting factor is the distance between nodes.

    There are currently no official plugins in C2 that would enable him to do this, so I guess he needs to fallback to an event-based solution, or maybe a custom plugin...

    Basically, you need to gradually and recursively search available nodes (that are within reach) and try to follow the shortest path.

    I hate to ask but... how would one do this? I've been reading up on "A*" pathfinding and had a feeling that would be the key but I'm not entirely sure- it seems to be grid based in most examples.

  • I haven't really ventured into pathfinding beyond Construct 2's built in behaviors, but I've found that said behavior doesn't (seem to?) suit what I'm trying to accomplish.

    I have a star map of sorts in my game project. I want to calculate a path between a start and destination star. There's a maximum "jump range", so I'm trying to calculate a path through a map of stars to reach the destination point. It seems like a pretty common thing in games- Elite: Dangerous, Stellaris... in fact most space strategy games... all feature this sort of pathfinding.

    Where would one start in implementing such a system? Bit of a broad question I know, but after spending some time looking at pathfinding solutions online I'm struggling to see how it works when you have points without specific paths between them...

  • Actually blackhornet's solution works perfectly! I didn't even think of being able to save the dictionary object into a single key, now I just have to reload the dictionary and run a loop on it to retrieve the specific keys.

    Cheers for the help guys, hugely appreciated!

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • Hello yet again! Managed to find myself another conundrum that I was hoping somebody could shed some light on.

    This is a problem that's part of a somewhat convoluted system, so I'll try to focus only on the issue. Basically- I'm creating a save/load system for my game. It's strategy like, and set on a map which uses a few different arrays to store game info. I'm using the "AsJSON" expression to save the data into LocalStorage. Saving the game just writes these arrays to relevant keys, and loading pulls these keys back and loads the data back to the arrays.

    This works great. However, I'm struggling to figure out how to handle loading the game's "Faction Units" arrays. This is an array that I use to store the information for each faction's units. On game start, I loop through the Faction Data array which stores the faction information and create a Faction Unit array for each faction, using the index as the connecting ID.

    To be clear- there is only one Faction Data array, which has an entry for each faction, but a Faction Units array for each faction listed in the the former.

    Creating and saving these arrays as keys is fine, as I can use a For Each X loop to create a key for each array instance, and use CurX to pick the relevant Faction Unit array and store the ID in the key name.

    The problem lies in then loading these. I think the root of my issue is that loading is a two step process- you have to "get" the key, and on the separate "on found" trigger you can load the data to an array. But, I can't use the CurX expression in the "on found" trigger because of course it's separate from the loop. So I'm not sure how I'd go about reloading these arrays... this shows what I'm trying to do, obviously it does not work however:

    Is there perhaps a different way I could do it? Any help would be hugely appreciated!

  • Cheers! My issue was that I didn't even realise there was a base system angle within where I was only using an object's.

    I used angle(target.X, target.Y, shooter.X, shooter.Y) instead of ( Bullet.Angle - Target.Angle ) since I wasn't sure how that ended with the value I needed, also simply by adding the target's angle onto the second angle I took into account the rotation of the target.

  • Gday all,

    Such a simple little thing, I thought. That's now been bugging me for a week. So clearly not so simple. Or staring me in the face. I don't know.

    My problem:

    I'm seeking a way to calculate the 'side' that one object is to relative to another object. The purpose is to calculate which side a target has been hit when another target shoots at it.

    To illustrate:

    So here, the green object has 'fired' at the red object (the target). It would be a right side hit.

    I have had the system working in a few ways. Previously I just used 'within' and '90 degrees' while plugging in the angle between the two objects, and this seemed to work for calculating front and rear hits. But I need to bring in left and right sides as well, and I can't figure out how to do so. Again, I can calculate a static target, but this system also needs to take into account the rotation of the target.

    Thoughts?

  • Right, so, I'm asking this more so because I'm not even sure if it's possible. I'm trying to take a 'camo' sprite, which has a different animation frame for various camos, and overlay it somehow over a base 'mech' sprite which is black and white.

    Those are indeed MegaMek sprites, but I'm using them for now since they demonstrate what I'm trying to achieve. I just have no idea how they did it. Is it possible, and if so where should I be looking?

  • Say if I had a point, and I wanted to find another point that is x distance at y angle from that point, how would I go about calculating that?

  • Works perfectly, thank you for the help!

  • Many thanks, it seems to work well in my prototype, I didn't even notice that condition before!

    I'll try plugging it into my game tonight. My only concern is that I'm using the same object types for both the player and enemies. That's because they're all vehicles, and can be either AI or player controlled. The 'attack' function gets the 'firing vehicle' UID and 'target vehicle' UID passed to it as parameters, so I've been using that to pick between the instances.

    But if it's in the same condition, would I do something such as putting the objects into a family and using that to pick the second instance?

  • How would I go about determining a condition to either if an object is behind or in front of another object, in a top down shooter?

    Initially I was comparing the x and y locations, but the issue is that now both 'player' and 'enemy' objects can fully rotate and move about. So I'm experimenting with trying to compare angles relative to the 'target's' angle, but so far it doesn't work at all so I figure I must be taking the wrong approach.

    I found this from another thread but I can't seem to get it to work from a front/back standpoint:

    [quote:38z0tl9l]angle(player.x,player.y,object.x,object.y) is between player.angle and player.angle+179 (hit from right)

    angle(player.x,player.y,object.x,object.y) is between player.angle and player.angle-179 (hit from left)

    The game doesn't use physical objects, as it's a RPG pseudo-y game and 'attacks' are handled in functions which simulate dice rolls, damage etc etc, so I can't really use collision sprites, or at least I'm not sure how to without an actual projectile object.

  • Here's what the two arrays look like:

    Sorry for double-posting...

Dingo's avatar

Dingo

Member since 8 Oct, 2015

None one is following Dingo yet!

Trophy Case

  • 9-Year Club
  • Email Verified

Progress

10/44
How to earn trophies