Fengist's Recent Forum Activity

  • God, it's taken me 2 days to get this while to work. The thought of rewriting yet again it makes me ill. Plus, I'm going to have another much larger while loop that would be a bigger nightmare to convert into something else. Instead of completely rewriting this code into a different type of loop, is there no way to update a progress? It just seems bizarre to me that a while loop should completely freeze the app till it's done with no way to update a text or a progress bar.

  • Hell yeah, forum drama!

    But I´d agree that the output looks confusing, lucky I never worked with 3D arrays before. I like mekonbekons idea.

    I like it better than what's shown now. What I'd prefer is to show the x,y of layer 0 in row brackets and below that the x,y of layer 1 in row brackets. But I also understand that a 200x200x3 array, which is what I'm working with, is a lot of cells to put in one box.

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

  • 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

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • 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")
    
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