farflamex's Forum Posts

  • Ah of course, that's perfect because it tests either way. I only want the click to register if the fade is complete in either direction (i.e totally opaque or invisible), so I can just test for any mid-range opacity. Only just noticed you can test for opacity, thanks :)

  • Well it couldn't be much easier than opening a webpage right? Just export your game, and upload it to a webpage somewhere. I think I'm right in saying that you can use your dropbox space.

  • Is there a way to know when an object is currently fading in or out? I know I can catch it when the fade is complete (only fade out, not in?), but I'd like to know when it's in mid-fade.

    When I click a certain object, I want another object to either fade in or out. It works ok, but if you click again before the first fade is finished, it keeps restarting which doesn't look very good. I'd like to wait for the fade to finish before another click is allowed. I know you can catch when a fade out is finished, but not fade in apparently. If you could catch fade in finished, then I could set a boolean to true when the object is clicked and then set it to false when the fade finishes. But I can't do that because I don't know how to work out when fade in has completed.

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • Not sure if Construct 2 has a built-in method for this, or if there's an easy mathematical approach... if an item is rotated and it's hit by another object, how can I calculate which part of the object is hit? I know I can work out the angle between the two objects, but if the main object (i.e my player ship) is rotated, how can I tell which part is hit (e.g the left wing, the right wing, the cockpit etc)?

  • Ah HAH, you've hit the nail on the head, that's exactly what was happening. I couldn't tell because they all started off clumped ontop of each other, and they were all showing the final frame... since one of them (tpyical, the final, i.e TOP one) was SUPPOSED to show the final frame I couldn't see the others animating.

    Good job mate, thanks for the help :)

  • This might be something to do with the fact that all of this is happening inside an 'On Created' event in the first place.

    What happens is, when my ship is created, it hops to the 'On created' code for the ship, which then creates an icon to accompany it. So the code above is itself inside the ships 'On created' code.

    So the ship is created, it then creates the icon, it then sets a variable to the UID of the icon, so that they stay together and then, finally, it attempts to set the icon to an animation frame, as indicated by a variable in the newly created ship. That final part is the part which doesn't work, the rest works perfectly.

    So what I have is.

    Ship : On created : System Create 'Icon' (works)

                        Set ship variable to the new icon's UID (works)

                        Set the icon's frame to a variable which is entered in that ship-type in the editor (doesn't work).

    If I remove that third line and put it into a 'System : Each tick' event, it then works fine. Meaning that the code to set the animation from the ship's variable is ok, it just won't do it during the creation process of the ship. It's as if the variable isn't assigned until after the 'On create' or something.

    I am aware of course that the code would hop out to do an extra 'On create' for the icon, except in this case, I have no code for that. Not sure if the system hops out to do it's own internal stuff, but it hops back in and completes the 2nd line with no problems, just not the third line.

  • I would but I don't know how to add a screenshot to these forums :(

  • I did switch it around as you suggested, and it still works. But still no luck with the other problem. For now I'll do the update every tick, but I'll keep looking into it as it seems like it should work in the creation event.

  • Well you're right, the other way around does work just as well, but the problem is, that part was working anyway :)

    The part that isn't working is where I set the animation frame. The frame is set to a number, which is set in the editor for the newly created object, in an instance variable 'Iconframe'. It seems to always set the frame to the final frame in the sequence.

    So what seems to happen is, the object is created, it creates the icon, it matches up the variable with the UID, then it tries to set the icon animation frame with the variable, but can't do so. The variable is definitely set correctly because if I set the animation frame on every tick using the exact same action, it shows correctly.

  • I'll try to work that out. It's strange, that's what's happening. My object is in a family, maybe that's part of the problem?

    In typing, here's what I have....

    EnemyShips(family) on Created - System : Create object 'Icon' on layer 0

                                 - Icon : Set 'Match' to EnemyShips.UID

                                 - Icon : Set animation frame to Enemyships.Iconframe

    That's probably not padded correctly, but the gist of it is, create the icon when an object in the 'Enemyships' family is created. Set the variable 'Match' to the UID of the new object. Those two parts work.

    Then set the animation frame of the new icon to the value in 'Iconframe' which is set correctly in the editor for the objects. This part doesn't work.

    Maybe it's something to do with using families in this case?

  • I have a situation where, when an object is created, it creates a matching icon, which copies the main object's UID (so I can keep the two matched up) and then sets the animation-frame of the icon, depending on a value stored in an instance variable of the created object. This is because all of the icons are single-frame and stored together as a single object, 1 to each frame (makes other parts of the program simpler).

    Slightly complex explanation, but here's the bit I'm having trouble with. I do the above in an 'On created' event. The first two parts work, it does create a matching icon, it also correctly sets the variable for the icon, to the UID of the created object. But then it doesn't set the animation frame for the icon, based on the variable in the newly created object.

    Only thing I can think of is, when it's inside the 'On created' event, are the new object's variables set before the actions take place? Because the variable is set in the editor but it won't transfer into the animation frame of the icon.

    The only solution right now (which works but seems wasteful) is to set the animation frame every tick. Once it's got past the 'On created' event, the variables all seem to be in place.

    I guess my question is, when I do an 'On created', are the instance variables which I've typed in editor immediately assigned, or aren't they assigned until after that event?

  • That happens to me all the time, I can't work something out, then I put up a post and 5 minutes later I've solved it. It's as if writing it out makes it clearer in your own head :)

  • Excellent replies guys, and a big thank you :)

    This is exactly what I need as I had a feeling there was a better way than I was describing. I was particularly confused about how I'd get the image to show at the edge of the screen, since the screen is rectangular so it's not just a case of showing the objects at a certain distance and angle from my spaceship. This describes that very well and without it it would have taken me forever to work out :)

  • I have a situation where my game objects can disappear off the edge of the screen, but continue to exist. The player needs to know where these objects are so that he can track/follow/avoid them. Rather than a radar, I prefer the idea of having little icons which float around the edge of the screen, in the direction of the objects.

    I'm trying to work out the best way to do this. One idea I'm thinking is that when the object is created, an icon object is created at the same time, with some sort of ID for both - i.e they could both have a variable which is set to the same value. The game then needs to check each frame to see if the object is on the screen - if it is, the corresponding icon has it's visibility turned off - if it isn't, the icon is made visible and it's position calculated. And of course, when the main object is destroyed, the icon has to be destroyed too.

    This would probably work but sounds a bit intensive and fiddly.

    Is there a better way of doing this?

  • Having the same problem on this, and my other game http://www.kongregate.com/games/farflamex/survivors-2

    When you use the arrow and space keys, it scrolls the entire screen around to keep the frame in view. What's causing this? I put them both down with the screen size I used, 480x640, but both screens have scroll bars and I assume using the space key for pause is a bad idea in a browser? How do I fix the screen resolution issue?