Fengist's Forum Posts

  • Ok, that makes sense. I was trying to put an Ajax on event inside another ajax on event.

    Thanks.

  • Was watching my code in the debugger. I have several Ajax events that keep firing even when there's no Ajax request being sent. So, I thought I'd streamline things a bit and create an Ajax On Any Completed and then, move all of my Ajax On Completed events under it. That way, the code isn't constantly checking half a dozen events and is instead, checking just one.

    Well, I was surprised to find out that I can't make an Ajax event a sub event.

    So, I thought I'd be clever. I'd create a function and On Any Completed, I'd call the function to see which Ajax event completed. Wrong. Apparently you can't even make any Ajax event part of a function.

  • Still trying to figure this out. Here's some more details:

    Taking a look at the HTML in Chrome developer there is a 'div' for most every element. The div for the skillbox looks like this:

    <div sa-uid="53" id="" style="font-family: Arial; font-size: 12px; color: rgb(0, 0, 0); font-weight: normal; font-style: normal; text-align: center; border-radius: 0px; padding: 0px; overflow: hidden scroll; transform-origin: left top; opacity: 1; position: absolute; left: 460px; top: 393px; width: 950px; height: 376px; transform: rotate(0deg);">
    

    Of note is the width: 950px. On one machine, with the same construct code mind you, that width stays at 950. On another machine, that width changes based on how wide the browser is.

    So my question now is, what sets the CSS properties for this 'div' and why is it changing on one computer and not the other? Does the plugin set these CSS styles or does Construct?

    I've also checked, both computers are using the latest version of Chrome.

    Chrome warning note to self when I check other machine: [C3 preview] Browser opened wrong size popup: wanted 1600 x 900, got 1584 x 821; resizing to compensate.

  • I agree with AllanR. You're using local storage like a variable. It should be used for saving things that you want to remember when the user quits playing so that you have that info the next time the user starts the game. You should load them on start of layout and save them only when you need to. The rest of the time, just use a global or local variables.

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • I believe, Chrome mandates that a user press something before it goes full screen.

  • Ok, it's becoming apparent this is peculiar to the HTMLElement plugin but I can't understand why.

    Here's an image of both the SkillsBox and the SkillsInfo box selected in debug. The box sizes appear to be correct but apparently the contents are getting scaled down depending on the browser size.

    What I don't understand is why on one machine this scaling is taking place but not on another. Any ideas?

  • So, here's the issue. I have several elements on a layout. Whenever a layout loads or the browser gets resized, I run a function to position these elements based on the viewport variables.

    Aside from the fact that this gets damned confusing because depending on how you resize the browser the Viewport vars can actually go into the negatives, I'm having issues with different behaviors on different machines using the same save file.

    For example. On one machine, I can set the width of the element in the properties and it keeps that width regardless of the browser size. On the other machine, same save file mind you, when the browser width changes, the element's width changes.

    Same thing with position. I tell it to position an element based on another element's x position and width. On one machine, it's position stays where it should when I resize the browser. On another, it moves left and right depending on the browser size.

    Now I thought maybe this was because of resolution or some such. But I'm basing my location on fixed coordinates and not percentages.

    On one machine, this perfectly positions and scales the SkillsInfoBox based on the location of the SkillsBox and it perfectly resizes the SkillsInfoBox based on browser size.

    -> SkillsInfoBox: Set position to (SkillsBox.X+SkillsBox.Width , SkillsBox.Y)

    -> SkillsInfoBox: Set width to ViewportRight(0)-SkillsInfoBox.X-20

    On the other machine, in order to achieve the same effect, I have to do this:

    -> SkillsBox: Set width to SkillsBox.X+750

    -> SkillsInfoBox: Set position to (SkillsBox.X+980 , SkillsBox.Y)

    -> SkillsInfoBox: Set width to ViewportRight(0)+ViewportLeft(0)-SkillsInfoBox.X-20

    You'll note that these lines of code are quite different. On one, I can set positions and width based on the SkillsBox position and width and the Viewport vars. On the other, I have to manually set width's and I'm having to add in the ViewportLeft(0) in order to correctly calculate the element width.

    So I can only come up with 2 reasons why this would happen. Either the viewport calculations are vastly different on one machine than they are on the other (which doesn't explain why an element resizes on one machine and not the other) or some setting that I'm totally missing isn't getting saved in the save file.

    Here's a visual. The SkillsBox is on the left, the SkillsInfoBox is on the right with the red border (so I can see the x position and width better)

  • Create a text element and add a bullet behavior. Uncheck 'set angle' on the behavior.

    And, here's your code:

    + System: On start of layout

    -> Text: Set position to (ViewportRight(0)+1, 0)

    -> Text: Set Bullet speed to -150

    + System: Text.X+Text.Width+1 < ViewportLeft(0)

    -> Text: Set X to ViewportRight(0)+1

    This is a very, very basic 'ticker.' If your text is static, this will do the job. If your text changes, you're going to have to come up with your own way to set the width of the text box because that's how it decides when to reset back to the beginning.

  • F = 0
    Толчок = 0
    
    Press space:
    Accelerate 30
    Толчок=15000
    
    F=0+2
    Accelerate 30-2+2 = 30
    Толчок = 14000
    F=2+2
    Accelerate 30-2+4 = 32
    Толчок=13000
    etc..
    F=28+2
    Accelerate 30-2+30 = 58
    Толчок=0
    
    Press space again:
    Accelerate 30
    Толчок = 15000
    
    F=30+2
    Accelerate 30-2+32 = 60
    Толчок = 14000
    F=32+2
    Accelerate 30-2+34 = 62
    Толчок = 13000
    etc...
    F=58+2
    Accelerate 30-2+60 = 88
    Толчок = 0
    

    It's doing what you're telling it to do, increasing the speed.

  • Well, the brief look I took, I saw the numbers over the blocks being displaced. By anchor, I meant, did you use the anchor or pin behaviour on those numbers in order to lock their position over the box?

  • Did you 'anchor' the text to the blocks?

    Well, wasn't really a correction. You provided more details so I could provide a better answer. I'll be interested to see what you create.

    irrelevant

    stop misleading

    Misleading? Irrelevant? I don't know what planet you live on but the physics on my planet dictates that a cell phone is NOT going to host 1,000 players simultaneously. Period.

    Furthermore, the physics on my planet is dictated by the speed of light. Whether the player is farther away or closer to the server has ZERO relevance on how the server is communicating. DISTANCE determines the delay in the signal whether it's UDP, TCP, FTP, HTTP, Websockets or a tin can on a string (ok, so that last one is dictated by the speed of sound. Same principle).

  • Well, until recently, I've been able to right click elements on my layout and 'inspect'.

    Now, when I run in preview I'm having to "open in chrome", go to the dropdown menu, find dev tools, open that up, click on the element tab and then drill down through the html to find the element I want to look at.