LukeW's Recent Forum Activity

  • I had a go at this for you, but I think I can't post links because I'm new, so not sure if this will work. Try this:

    dropbox.com/s/gi7vdjf2xbuedys/rtype%20beam.capx?dl=0

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • Sounds like you're setting the Y position to a static number, try something like text.Y + 50

  • Nah, they won't be cosmetic, major part of the game would be trying to keep them safe. And bullet behaviour won't work as, as I said, there will be a command to make them wait/follow so it will need to pick up the path from different positions.

    I had a play around with it before and this is what I've got so far. Would love to hear feedback on better ways to do this if anyone feels like checking it out. Technically, it works, but I'd prefer to be able to do this without having to track the player facing position. Feel like there's a better solution to this and, as it's a core mechanic, I don't want to start off with something rubbish

  • Hey there,

    Got a question regarding best way to implement a game mechanic. Basically, I want a separate AI (think cat or dog) to follow the player around the world, keeping a set distance from the player at all times. If the player starts moving in a different direction, I would prefer that the AI stays where it is and wait for the player to pass them, rather than running ahead to get behind the player. I would also want to be able to issue a halt/follow command to the AI, so it won't always be following the player but might need to catch up.

    The game would be top down, so both X and Y need to be considered.

    So I had a play around in C2 trying to get this running. At first I thought I could maybe run a bullet behaviour off the AI with it set towards an angle of player.X with an offset to sit it behind. But I can see this wouldn't work if there was a solid between player and AI.

    Pathfinding sounds like it might be the answer, but I have a few issues regarding this. All the documentation on pathfinding states that it's system intensive. As the AI is going to need to be continually changing paths to follow the player, I can see that this might be a real technical issue, especially if the player has more than one AI following. There also seems to be an issue where pathfinding doesn't work well in the every tick event, which I assume is because it has to find a path before moving along it.

    So, what I'm thinking now, is maybe I need to set up the pathfinding for it to run every X seconds as a way of lowering system load, but I'm still concerned that this isn't the best way to do it. I've been searching for some resources on this this morning, but either my Google powers are running out, or this question hasn't been covered. There were a couple of projects I found that I thought might be good to look at, but all the download links were broken.

    What's the best practise for AI -> player pathfinding then? Has someone successfully achieved this using C2 and, if so, is there a project I can check out that demonstrates it?

    Cheers

  • Set frame to (self.AnimationFrame +1) % self.AnimationFrameCount

    % is operator for Modulo

    This works perfectly!

    Thank you.

  • hey guys, first post here, thought I would ask something that is probably pretty obvious.

    Been trying to think of an elegant way to do the following: I have a sprite with multiple frames that I don't want to change until the user presses a button. Once the last frame in a cycle is up and the button is pressed again, I want the frame animation to reset to zero (basically, it's a character creation panel, so user dictates frame change).

    At the moment it stops at the last frame and doesn't cycle. I thought maybe changing the animation to a loop would bump it back to zero, but nope.

    So obviously it's easy to use set frame to go to the next frame when the button's pressed, and I was able to use a variable which counted the frames and reset it once it hit a certain number. Problem is, I want it set up so that I can change the number of frames in an animation without having to change individual variables, and have it still work.

    I tried comparing self.frameAnimation with self.frameAnimation +1 and resetting frame to zero if they were equal, but it didn't work for me. I guess it's comparing it to a number that doesn't exist in the cycle... realise my mistake there now as I typed it.

    I am really tired right now (had an early morning flight to catch), so I'm beginning to think I might be overlooking the obvious.

    Would love to hear what best solution to this would be. Something to look forward to in the morning

    Cheers

LukeW's avatar

LukeW

Member since 26 Mar, 2017

Twitter
LukeW has 9 followers

Trophy Case

  • 7-Year Club
  • Forum Contributor Made 100 posts in the forums
  • Coach One of your tutorials has over 1,000 readers
  • Regular Visitor Visited Construct.net 7 days in a row
  • RTFM Read the fabulous manual
  • Email Verified

Progress

12/44
How to earn trophies