farflamex's Forum Posts

  • 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).

  • 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.

  • I can see the wisdom of that approach, I can see times when the extra control would be useful, and you can never have too much control :)

    On the other hand, a simple command to combine everything might be useful if it was possible, something like a 'Is showing' which combines everything to determine if the object is actually showing at that time.

  • Is this correct? If I make a layer invisible, and then do a count of visible objects which are on that layer, it still reports that all of the objects are visible, even though they're not. Does the fact that they're on an invisible layer not set them as invisible?

  • Can you do this? My game looks excellent in crop-mode and full-screen and I've done the calculations to allow the screen to change size, but it runs very poorly on older hardware and needs to be run in a smaller screen-size, set at 800x600, which requires me to change the 'Fullscreen in browser' mode, with an option in the game or something. Can you change that setting during run-time?

    I know I can change from windowed to full-screen with the browser object, but I don't see a way to change the project properties.

  • I think I'm right in saying that you can calculate it by the collision angle minus your facing angle. I think that works. If the collision hits you at 90 degrees (from below) and you're facing 180 degrees (left), then the hit came at 90 - 180 = -90 (converts to 270), which is your left, which is correct.

    If the collision came from above (270 degrees) and you were facing left (180), then the angle would be 270 - 180 = 90, which is your right.

    That works for my case at least, hope it helps :)

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • Thanks, I'd never have worked this out on my own :)

  • Is there a way to do this? I want to always show 1 decimal point after my number, including when it's 1.0 for example. I know I can do Int(Number*10)/10 to get 1.1, 1.2 etc, which limits it to 1 decimal point only but if the original number was 1.0, it'll just return '1' as the answer.

    So for 1 I want to show 1.0

    For 1.1 I want to show 1.1