Fengist's Recent Forum Activity

  • So, using the trick from a for loop, I'd put a wait 0.1 in my while statement in order to update a progress bar. However, if you put a wait inside a while, the net results seems to be it locks up the entire app, which ends in an 'oh-snap' in the preview AND the editor.

    Now surely, there must be some way of updating a progress in the midst of a while without locking everything up? From what I'm seeing, if you execute a while, everything freezes till it's done.

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • No, don't use round(), it will skew your results.

    Pretend random returns single decimal point values. So 0.0, 0.1, 0.2, etc.

    Using round() will return 0.0, 0.1, 0.2, 0.3, 0.4 as 0, but 0.5-1.4 will return 1. That pattern repeats until the other end, where the last number is also only half as likely to show up. The most accurate way to get an integer is to use int(random) (or floor). Then all numbers are equally likely.

    If his random, as he says it from 1-11 then it should not return anything less than 1. Were his random 0-11 then yes, it would return a 0-1.

    But I see what you're saying. I just never worried about that difference that much. I used ceil or floor.

  • System: Set Layout Angle

    Does that actually change it from portrait to landscape or just spin the layout with the rotation staying the way it is?

    Then again, I may have misread what he's trying to do.

  • I don't think you can force the rotation to change. That's something the actual device decides depending on which way it's turned. In the project's properties you can lock the rotation into portrait or landscape or, you can set it to 'any' which allows it to rotate when the device is rotated. You can use the browser plugin to see whether it's in portrait or landscape and you can lock and unlock the rotation.

  • construct.net/en/forum/construct-2/how-do-i-18/tips-posting-quothow-iquot-40390

    Without an example, I can think of a hundred reasons why sound wouldn't play.

  • To answer your questions.

    Yes, c2 and c3 could be used to make a city builder if you mean something like sim-city. While you could likely do it with just a tileset, to me, keeping track of what tile is where would be a chore and I'd likely adopt a strategy of using an array and copy that over to the tileset. And even then, it would be a lot of work keeping track of things. If you're new enough to construct that you're not sure where to begin on this project, I strongly suggest something a bit easier to get yourself familiar with the intricacies of programming in c2/c3 and come back to this when you feel more confident.

    As for selling with the free version: yes and no.

    construct.net/en/tutorials/how-construct-2-licenses-work-64

    '- Not allowed to be used for commercial purposes (however, it can be used in education and other non-profit organisations).'

    Either way, I seriously doubt if you could make something like this with the limitations of the free version.

  • I think you'll want round(random(1,11))

    int(random(1,11)) will just chop off everything after the decimal giving 1-10.

    round returns the closest integer so that 10.6 = 11 and 10.4 = 10 so you get 1-11

    ceil returns the next highest integer so that 10.1 = 11 (rounds up) and you get 2-11

    floor returns the next lowest integer so that 10.9 = 10 (rounds down) and you get 1-10

  • I don't think you're doing anything wrong. Ajax needs a special 'header' on the other end to allow it to interact with the website. The google url has that header. I don't think example.com does.

    Just do the head post to the google url or one of your own. It's fast and there are no ajax results actually returned so it doesn't consume any memory.

    Here, this definitely works on my system:

    https://www.twistedvoid.com/c3examples/headcheck.c3p

  • And I run this:

    + System: On start of layout
    -> AJAX: Send "" to URL "https://ajax.googleapis.com/ajax/libs/jquery/3.4.1/jquery.min.js" (method "HEAD", tag "example")
    
    + AJAX: On "example" completed
    -> Text: Set text to "passed"
    
    + AJAX: On "example" error
    -> Text: Set text to "failed"
    

    And it comes back passed which looks exactly like what you have.

  • I personally couldn't get example.com to work. But to do a "HEAD" call which only returns the header of the site you're contacting and not all of the content (which is smaller memory wise and a fraction of a second faster), change the first line in my example to this:

    -> AJAX: Send "" to URL "https://ajax.googleapis.com/ajax/libs/jquery/3.4.1/jquery.min.js" (method "HEAD", tag "check")
    
  • Also, keep in mind that anything you have set to global is created for the duration of the game once it is created unless you specifically destroy it.

    For example. Drop a button and a text on a layout. Create another layout and drag the same button and text onto it. Have the button on layout 1 go to layout 2 and have the button on layout 2 go to layout 1.

    If you run it in the debugger, and expand the trace for the text object, you'll see that when you click the button to switch layouts, it creates an 'instance' of the text for each layout and destroys it when you switch layouts so that only one instance of the text exists at any one time even though you have it on 2 layouts.

    If you set that text to global though, it still creates a new instance when you switch layouts but doesn't destroy the one from the previous layout so you end up with two instances, just different UID's.

  • He's saying if you don't want to host your own file/site, use example.com as the url. And don't use the ajax post or get, use the head call, which I'd agree with.

    The problem I have with any site or domain other than your own, you can't guarantee that they'll always be there.

    As far as the tcp, I assume he means websockets. If c3 or c2 has some way of sending tcp/udp packets without writing JS, I'd love to know about it.

Fengist's avatar

Fengist

Member since 6 Nov, 2015

Twitter
Fengist has 5 followers

Trophy Case

  • 9-Year Club
  • Forum Contributor Made 100 posts in the forums
  • Forum Patron Made 500 posts in the forums
  • x3
    Coach One of your tutorials has over 1,000 readers
  • x2
    Educator One of your tutorials has over 10,000 readers
  • Regular Visitor Visited Construct.net 7 days in a row
  • RTFM Read the fabulous manual
  • Email Verified

Progress

16/44
How to earn trophies