ch4rl1e97's Forum Posts

  • 4 posts
  • You're right that it should be a string. You can convert a number to a string with the str() expression.

    Go to layout: str(CurrentLevel)

    Thank you very much, I'll get to putting this in now!

    hey that's twice you've helped me now!

  • Problem Description

    I am unable to reference a numerically named layout using the value of a global number variable.

    Attach a Capx

    ht*tp*s:/*/*drive.google.com/file/d/0B7IHutHbyg8dMkhYYlNWbHNtWDQ/view?usp=sharing

    (dunno how to invoke a download automatically, you can download from an icon at the top of the page)

    Description of Capx

    There is a "main" layout which should be the layout you run, it has a button which takes you to a "UI" layout that has a globalised text object for demonstration purposes, The "main" layout has an event sheet, and "UI" has a separate event sheet. There is also a layout called "1", which has a green square on it so you know when the layout is open due to it's presence.

    Steps to Reproduce Bug

      Run layout from "Main" Click button

    Observed Result

    Starting the Main layout and clicking the button takes you to UI layout, then nothing happens. Text is present as expected but process stops there. Debug mode shows that the global value WAS incremented to expected value. (1)

    Expected Result

    Starting the Main layout and clicking the button takes you to the UI layout, showing the text object, the global variable "CurrentLevel" is incremented from 0 to 1, then the level 1 layout should load, showing the green square alongside the text brought over from the UI layout.

    Affected Browsers

    • Chrome: YES
    • FireFox: YES
    • Internet Explorer: YES

    Operating System and Service Pack

    Windows 10 (Home) Latest updates are installed.

    Construct 2 Version ID

    release 227 (64-bit)

    I theorise that this is due to the global number variable being just that, a number, rather than a string, which the name of the layout is, the difference in datatypes is making C2 frown upon my event sheet, despite visibly the number and the string look the same, they are, on a computer-y level, different things.

  • Have a "ball is overlapping goal" condition along with "compare ball.pickedcount to ball.count". If the number picked by the overlapping condition equals the total number then they're all overlapping.

    Genius! I wasn't aware object.pickedcount existed Thanks for this insight!

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • Hiya,

    Say I have multiple say "ball" objects and I have a "Goal" object, the balls are physics'd sprites that you must get all of them into the goal, OR a certain minimum count of them. The goal just being a square sprite that acts as a goal 'zone'.

    How Can I keep a count of how many of the ball objects are overlapping the goal? Would it work if I had multiple goal objects in a level and it kept a total across all the goals.

    Also say if a ball fell out of the goal then it would subtract 1 from the goal'd balls count.

    I've managed to google and search up every question I've had before now but I'm stuck at this point

    Thank you muchly <3

  • 4 posts