farflamex's Recent Forum Activity

  • It's definitely a bug of some kind, but I can't reproduce it. When I made a small program from scratch using the exact same logic, it works perfectly.

    Here's that program, it shows you the indents as I was attempting to describe them.

    Link

    That program is basically the same as my game, but obviously much simplified, but that's the 'else' logic that my game is following. On the final 'Else' line, as a bug-check I have set it to show the values of A and B. It my game they show as 0 and 1, and yet the very next line 'If A is not B' fails to process, so something is bugged. I'll just have to find another way around this one.

  • If you mean the entire game is occasionally stuttering, I've found this happens anyway and just seems to be a performance issue. I generally find it runs very smoothly, but every now and then, I do get some stuttering in my game which sometimes lasts for several minutes, sometimes hours, then everything runs smoothly again. I get the impression that the browser is probably being lagged by something like a background process.

  • I've read elsewhere that 'else' is bugged but the posts are very old, so just wondering if it still is.

    I have a setup like so....

    Else

    Indented Else     : Show Text A & B

       Indented again : A is not B - Action.

    I can clearly see in my example that A is not B because it's shown by the text above as 0 and 1, but the next indented line doesn't get processed anyway. There is no other code between the two lines, so it should 100% be processed since the text above confirms that A and B are different.

    So is Else still bugged when indenting like this?

    I've updated to point out that this is indented from a previous else, which I read was bugged, but that was 2 years ago.

  • It probably sounded like I know the locations of my sprites, but I don't. I'm placing them by moving them both a certain distance from the same location, but the screen can be stretched so I need to know the distance between them regardless of screen size.

    So basically I know the point of a triangle, and the 2 angles and sides coming from that point. I'm trying to then calculate the length of the third side.

  • I think there may be a simple solution to this, either something in C2 or a trigonometry answer (I think one of the basic trig rules covers this but can't remember it).

    I have two points that I wish to know the distance between, but all I know is their start location (the centre of the screen), their angle and their distance from that point. Since I want my screen to be stretched, I can't used C2's built-in distance function.

    So I guess if I know one corner of a triangle and the length and angle of the two sides coming from that point, is it possible to work out the distance between the two other points?

  • I'm sure this is simple and has been answered before but I can't find an answer.

    I have two objects in the same place which switch screens (layers). When one is clicked, it switches to screen A, when the other is clicked, I switch to screen B. But they're both in the same place. Problem is, both are being clicked at the same time so only one works (i.e both get processed).

    I'm checking the layer of the object, which I normally use in these situations but it's not working.

    E.G

    If mouse clicks on sprite A.

    SpriteA.LayerName is visible   .... Switch to Screen B

    If mouse click on sprite B

    SpriteB.LayerName is visible   .... Switch to Screen A.

    I would have thought checking the layername would fix this but it's not working.

  • Thanks for clearing that up. It's another little peculiarity of C2 which makes it very complicated when these problems pop up, especially since there's no debugger. Still, I know now, thanks.

  • There was a reason I didn't do this originally (because the tiles are also being created by other parts of the program) but I'm sure I can get around it by testing which screen I'm on for example. Thanks, I'll go with that - I'm banging my head against a brick wall with the above approach so I need to try something else anyway, and it does seem like a better solution here.

    Still confused as to why the code doesn't work though, it really should.

  • And if you check the code again, forget all that stuff about UID's and objects, but can someone explain why that's not working? Look at what it does - the variable is set to -1. If the button is clicked, the object is created and the variable set to the UID (that part works and it does change the variable). Then it asks 'Is the variable NOT -1' and for some reason, it thinks it is. I don't see how that can be possible if I've just changed it to the UID of the new object.

  • Just to explain what I'm trying to do here.

    When the button is clicked, a new object is created. It can be one of 10 or so different objects, which are all in the same family. When they are created, they need a couple of variables set which are unique to that object, but then LOTS of variables set which are required for each type.

    So, what I wanted to do was, create the object, set it's variables, then find it in the family immediately and start setting all the standard variables. This part doesn't work in C2 - if you try to find it in the family at this point C2 doesn't find it because it's not registered until the next top-level event.

    So my solution (as mentioned on the forums for this kind of thing) is to create the object, do the couple of changes it needs, then save it's UID, start a new top level event, find it again in the family, then do all the other changes.

    The only alternative I'm seeing right now is to do the large number of changes for each object type, which would work but would be very laborious.

  • It's not attempting to play if the variable is -1, it attempting if it's NOT -1. In other words, if the variable was set to the UID above, then it should play.

    Also I can't use an else event here, remember this is stripped-down code and the reason I'm using this approach is that I need to work with the newly created object later on, but C2 won't allow that until you go back to a top-level event. This is a major problem I'm having regularly with C2. You need to either manipulate the object immediately inside the event-chain it was created in, or go back to a top-level event. So in this case, I'm storing the UID, then going to a top-level event and if the global variable has a UID stored instead of -1 it should play the sound.

    That's the code exactly as I'm running it, when I click the button, the variable is set to the new UID, meaning the sound should play in the next block, but it doesn't.

    I'll take a look into triggers, but I should point out that I'm aware that the code above isn't the best approach. I'm using this approach because I need to store the newly created object, then work with it in a new top-level event which is a C2 issue.

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • https://www.dropbox.com/s/ouo3me42a8ygh95/c2bug.png

    As you can see, the top line sets the variable to -1. If the mouse is clicked it then creates the new object and sets the variable to the new object's ID. It should then follow that the next line is actioned, since the variable is set to the UID so the sound should play, but it doesn't.

    Obviously this is very simplified, but I can confirm that it doesn't work and the sound is fine elsewhere. The reason I'm doing seperate 'Is layer visible' top-level events is because the code is more complex than this but it requires that to get the new object to register.

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