farflamex's Recent Forum Activity

  • Cheers Ashley. Actually that's handy to know about the destroyed objects because I'd noticed that behaviour myself and wasn't quite sure why it was working as it did. Now I know :)

  • I can't post because my game is over 500 events now.

    So in this case, there are 11 spaceships. 10 are set to team 1, and 1 is set to team 2. When I ask for the number of ships from team 2, it correctly returns 1. If that ship is then destroyed and I ask for ships from team 2 with again, it returns 1 still.

    I could understand if it returned 10 (all the existing ships) or 0 (the correct answer).

    It's not hugely important now since I've worked around it, but if you want to go ahead and explain, that's cool - no harm in my brain knowing what's going on :)

  • Yeah you're right, I am thinking about it backwards. Still strange how it comes up with the number 1 though.

    But your solution does the trick anyway, just do an else block, that'll solve it :)

  • When there are no objects to pick, it presumably just skips the whole process, but you would have thought that it would start out with zero and therefore pass zero as a result? It's a bit awkward because I genuinely need to know how many objects I have in a certain situation, including if there are zero. I'm having to use a local variable and set it to 0, then set it to the pickedcount if it makes it to the next subevent, then test that later.

  • I've seen a couple of other people mention this but not seen a real answer. I've noticed that pickedcount always returns 1 when it should be returning 0. Is this supposed to happen and is there a workaround?

  • Yeah, I noticed that it wasn't working correctly for some of my bullets until I changed it to grab the bullet speed from the firing object. I'm not sure if it's some kind of bug in C2 but if you change the 400 to a very low value (e.g 1 or 2) my frame rates dropped to practically zero. Not that it mattered since my bullets aren't going to be travelling that slow, just an observation (and could be due to something else in my game, which is around 500 events long now).

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • Wow, excellent stuff, and it's all contained on a single line! Now that'll save me a lot of headaches, thanks :)

  • There's a fairly simple solution which isn't perfect, which is to work out the distance between the firing object and the target object, divide that by 6 or 7 (will vary depending on the bullet speed), then add that distance infront of the object in the angle it's travelling, and fire towards that point. That does give fairly decent results but it's not perfect and only works with set bullet speeds.

    I'll have to go back and work out what the hell a quaternion is and how to translate that to C2.

  • Sorry, I didn't describe it properly. What I meant was, the object is moving so the bullet needs to be fired ahead of the object, otherwise the object moves along it's course and the bullet drops behind. 'Deflection shooting' I think they call it. I need to calculate where to fire the bullet ahead of the object so that they'll collide.

  • I've read up on various topics on this but they all seem to include strange mathematical symbols and are coded in other languages. Can anybody explain in plain English (or a Capx) how this is achieved?

    If I have a stationary object which needs to fire at a moving object (both seen from directly above), how do I calculate the angle to fire the bullet at? I know the speed of the bullet and the enemy is moving at a constant speed.

  • Yep, that worked, thanks. Still finding it a bit confusing when I need to use a 'For each', since I'd filtered the objects correctly and thought the subsequent conditions applied to each of the filtered objects anyway. Still, it works.

  • I'm having a really strange problem with this which I can't resolve.

    I have 3 layers, each with a tile on it, which I want to be clickable with the mouse. They're all in the same place but I only want the one on the currently visible layer to be clickable. The tiles are in a family but I don't think that matters here.

    So the solution would seem to be....

    Mouse - On left button clicked on 'tiles'

    System - tiles.Layername is visible

    I would have thought this would filter so that only the tile which is on the visibile layer would be picked. But it doesn't work when there are 3 tiles ontop of each other, and only one layer is visible (it picks none). If I move one of the tiles so that it's not in the same location at the others on the invisible layers, it does pick that one tile when visible and clicked).

    Just to add to that, if I remove the second condition (check if the layer is visible), it does then correctly pick all 3 tiles. So the first condition is working correctly, it does pick the 3 tiles that have been clicked, but something's wrong with the way it filters the next condition.

farflamex's avatar

farflamex

Member since 7 Oct, 2012

Twitter
farflamex has 15 followers

Trophy Case

  • 12-Year Club
  • Forum Contributor Made 100 posts in the forums
  • Forum Patron Made 500 posts in the forums
  • x2
    Popular Game One of your games has over 1,000 players
  • Famous Game One of your games has over 10,000 players
  • RTFM Read the fabulous manual
  • Email Verified

Progress

18/44
How to earn trophies