farflamex's Forum Posts

  • I understand why you think several 'on start of layout' events seems messy, but in the end I had several anyway, just to split up the amount of stuff I need to do at start-up.

    This situation with needing to set variables for objects on a new top-level event has caused me lots of headaches, but there's always a solution.

  • It's the thing I still find most aggravating about C2, but the link explains why it's necessary. You get used to it, basically you just find ways to create your objects in one event then manipulate them in a new top-level event. 'On created' usually solves it but other methods, such as your top example also do the trick.

  • I'm confused about ViewPort. I hadn't noticed this until recently when I added a start-screen to my game. The stuff doesn't appear where it should appear. For example, if I put an object at 0,0, it just appears near the middle of the screen, which is wrong.

    Somehow I seem to have not noticed this in 4 months of programming. My main screen is using WindowWidth and WindowHeight to calculate positions, and I'm using Crop-mode and scaling everything myself. It works fine, and 0,0 on my main screen corresponds to the top-left.

    ViewPort on the start screen just looks totally wrong, it has strange coordinates like the top left is at -448,-89.5. And if I get the centre of the screen with VPL+VPR/2 it gives 512. Since my screen window is 1920 pixels wide, I don't see how 512 is the centre of the screen (although if I put something there, it DOES appear in the centre, I just don't understand why).

    I'm not sure if this is important. My main screen works fine with my scaling and coordinates, on several browsers. I guess I could just work out what's happening with the start screen and use Viewport coordinates.

    * I am seeing partly what's happening. The left coordinate is -448 and the right coordinate is 1472. If you add 1472 and 448 you do get 1920, which is the correct width of the screen. I guess what's confusing is, why is my main screen working with 'normal' coordinates and the new screen isn't.

    * What makes this really confusing is, on my main screen, I position everything around the player ship (the ship stays in the centre and everything moves according to your position). That probably solves most problems automatically, but what I don't understand is, why can I place the ship at WindowWidth/2, WindowHeight/2 and it DOES appear in the centre. But when I do the same on the other screen, it doesn't? Apparently the VP coords are the same on both layouts.

    * After a bit of dabbling I think I understand why the two layouts are working differently. My player ship has the 'scroll to' behaviour, meaning everything centres around it (I think). Apparently the whole layout behaves differently when one object has that behaviour. I made some text with the 'scroll to' behaviour on the start screen, and now the whole screen works with 'normal' coordinates (i.e 0,0 is the top-left now).

  • By multiple lines of text, do you just mean a line of text, then another line underneath, stored in the same object? If you are, then you can just build your text object with 'Line 1'&newline&'Line 2'&newline&'Line 3' etc.

    Not sure if that's what you meant. Actually that saved me a lot of objects because I had 10 text objects ontop of each other and realised I could just stick them all in the same object with a newline between each line.

  • Hmm yeah, you're right, that should work I think... thanks.

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • I'm sure this should be easy with a simple while loop but I can't get it working.

    I have 50 objects, which have either a 0 or a 1 in a variable, let's say it's called 'Value'. I want to choose one of them at random, which contains a 0 in 'Value'.

    I was thinking...

    While

    Pick a random 'Object'

    Object.Value=0

        Sub Event - Do my stuff.

    But that's not working, not sure if picking in a 'while' works as I'm thinking it does. Or maybe there's just a much simpler way?

  • Forum is deciding to make my life hell tonight as well, dunno if you can follow that link.

  • .

  • Don't ask me why but it's refusing to allow a link to the image of the program. Oh well.

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