GeometriX's Forum Posts

  • There sure is: zeropad(number, digits).

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • If that's the totality of your turret's events, then you need to add targets for the turrets to acquire. Turrets need to know what to shoot before they'll do anything useful.

    Have a read through page four of my tutorial for an overview of the behaviour in action, and don't neglect the manual entry.

  • Why has this come up so often in the last week?

    Answer is here: scirra.com/forum/status-on-screen_topic66010_post405143.html

  • Download R124 and check out my example. It's dead simple - a single event. You should generally stay up-to-date anyway.

  • Have a look at this example.

    Just for example's sake, I've assigned the PlayerBox the platform behaviour so you can see how it moves, but in your game you'd obviously have some sort of custom AI movement set up for your mobs.

    The way you should set up your colliders should be the same, though. Notice that the actual box is the object that's controlled - the sprite is simple pinned to it. The box would be invisible in a proper game, though.

    Also worth noting is that when I pick the sprite (On Created) - it automatically picks the correct collision box in the pin action; this is the beauty of containers.

  • The simplest way I can think to address this "problem" (technically it's a feature more than anything) is to hide the UI elements when you don't need them.

    Since you're still using the free version of C2 you won't have access to families, but you can create an event in your menu event sheet that, on the start of the layout, sets each UI element to invisible (families would let you do this as a single action). Then just make sure that you do the opposite in each actual level's event sheet.

    If these are UI elements that are interactive, then add a condition to their interaction events that checks if they're visible before performing the action.

  • Use containers: this will ensure that each mob gets a collision box when it's created, and when one dies, so will the other.

    The simple method to pin a container is with the pin behaviour. So do something like this: when the mob is created, position the collision box to it, and then pin the box to it (two separate actions, same condition). With containers, the box is automatically created when the mob is created, and the correct instance of the box is automatically picked when you pick the mob.

    Pinning and assigning position every tick are identical in terms of functionality and resource usage.

  • dragoonblade a lot of people think that. Not sure if it's a language barrier, people not reading carefully or (more likely), newcomers who don't understand the terminology when they first read about the limits, and end up thinking they actually read the other word.

  • Because I thought this was all rather interesting, I created a small test to determine how much of a performance hit is taken generating objects on-screen as opposed to off-screen.

    This test has two options; both use identical events to generate one of each of three sprites every tick and displays the time, frame rate and sprite count. One test only creates the sprites on-screen, and the other uses the entire layout. The tests will give you the exact count of sprites at which the frame rate reaches 30.

    You can try it yourself here. I don't know how scientific this test really is, and I'd be interested to get some feedback on its accuracy as I think it could have an effect on how layouts are designed for games that depend on a smooth frame-rate.

    For reference, on my machine, test 1 takes 8310 sprites to get to 30fps. Test 2 takes 11043 to get to 30fps

  • Yup, menu/title screens and new levels are (generally) created in separate layouts.

    In the free version you can have unlimited layouts, but only up to four layers per layout.

    The option is here:

    <img src="https://dl.dropbox.com/u/14522925/C2%20examples/new-layout.jpg" border="0" />

  • There's no way to pre-play the particle effects, so Sushin is right - you'll have to find a workaround.

    Is it always snowing in your game? Would you say that it's snow-themed? If so, I'd suggest that you make your snow particle system global (i.e.: it's not destroyed between layouts) and place it in your initial title screen (just mock one up for the sake of testing if you don't already have).

    Actually, thinking about it now I'd say you could even generate the particle system while the game is loading. If you'd rather not have it look like it's there, then just set it to invisible. Read about custom loading screens here.

  • I think what GameThirsty means to say is that you should put all of your UI elements into their own layer, and set that layer's parallax property to 0,0. Details here.

    You should really read at least a few of the basic tutorials before charging off into your own project. If you ask for help, the expectation is that you've read them and have a basic understanding of these sorts of things.

  • Oh, okay I get it. NaN is what happens when you attempt to write a "" value from WebStorage to a number variable, which I assume is what's happened to you here.

    I can't find any way to check for NaN, so I recommend this: You first need to send a value to WebStorage before you can retrieve from it. I suggest using a global variable (CurrentScore) and only recording to WebStorage at the end of each level, and only pulling in your score from WebStorage when you load a saved game instead of trying to pull it actively right at the beginning of the game.

    A global variable will keep throughout your entire play session, so you don't need to actively write to and read from WebStorage the whole time.

    Either that, or initialise your WebStorage keys - just set them to "0" on layout start.

  • There is an action that compares the value of variables, if that's what you mean?

    So, like:

    CurrentLevel = 1 -> do all of these sub-events to create these monsters every whatever seconds

    CurrentLevel = 2 -> do all of these sub-events to create those monsters every whatever seconds

    etc.

    I'm not sure exactly what your code looks like because you've chosen a really small snippet, but if I were to guess I'd say you wouldn't even need to use while.

  • I don't think there is a built-in null function, but you could just check if the value of a key is "" or not. Since a key must be created with a value of at least "" (it can't be blank), that's as close to null as you can get.

    I.e.:

    System -> Compare two values -> First value: WebStorage.LocalValue("key"); equal to (or not equal to); second value: ""

    Otherwise, there is an action to check if a key exists or not.