Guizmus's Recent Forum Activity

  • The Webstorage object exploits the "localStorage" javascript object. This storage is accessible from all pages/tabs in the same browser on the same domain, and have no expiration date.

    This mean you should use some kind of prefix in from of all your variable to keep them from mixing between your games, if they are hosted on the same domain.

    A simple way to do so is to create 2 functions in C2, a setStorage and a getStorage, that would take the key "highscore" as a parameter (in your example), and set/get in the storage using the key "application_prefix"&"highscore".

    Application_prefix needs to be a constant here, for example the name of the game and an underscore.

    Once you've got this, just change all the calls to the set/get you had by calls to these functions instead, and it should be all good.

  • That's the spirit :)

    If you know arrays in java or js, let me explain it like this in C2.

    Arrays have fixed, given dimensions in C2. You can't just "push" a new element inside, you set a value at a given index X in your array (well, you can push, but it won't change the array size).

    C2 gives you the option for multi dimensional arrays though, up to 3 dimensions. That means that you can have 3 index, X Y and Z.

    In your case, I would use only 2 dimensions.

    X would be the obstacle number (0 for the first arrow, 1 for the second arrow, ...)

    For a given X, we would store at Y=0 the timestamp and at Y=1 the arrows.

    Think of a matrix, with the first column being the timestamp, second one the arrows, a line for each arrow sequence.

    You access a data in an array using the "Array.At(X,Y)" instruction.

    Take a look to the manual on this subject for more infos.

    Last thing, you don't need to store an array to store 2 or more arrows. Just use a single string.

    "T" => top

    "L" => left

    "B" => bottom

    "R" => right

    "TLB" => Top + left + bottom.

    How to analyse this string in C2 ?

    just do 4 test for each string :

    if (tokencount(mySting,"T")>0) => there is a top arrow

    if (tokencount(mySting,"B")>0) => there is a bottom arrow

    ...

  • DDR (Dance Dance revolution, a game that plays songs and waits for the player to follow specific inputs scrolling on the screen, made of the keyboard arrows) has a file per song, stating what arrow has to be displayed when. This would be your array. I wouldn't go with the 0.1s segmentation, as if your song isn't on the right beat, it will feel ... not correct.

    Instead, in your array, store 2 datas : the timestamp and the arrow sequence to display.

    Example :

    [0] => (1.3,"T") meaning top arrow at 1.3 second

    [1] => (1.8,"TR") meaning top and right arrow at 1.8 second

    At the start of the song, you wait for the first timestamp to come, display the current arrows (use a bullet behavior to handle their movement), and increment the "current" counter.

    On any given display of an arrow, after displaying/incrementing the counter, you wait for (timestamp(nextArrow)-timestamp(currentArrow))) and call your display function again, until the end of song.

    Then, for the inputs, you would have 2 things :

    • a collision detection between the arrows and a "game over" line, where the arrows can't be clicked anymore if missed
    • on key pressed, checking if a corresponding arrow (top if top was pressed, ...) is near the right place (where it should be on screen when you should click it) and handle the if and else accordingly.
  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • It makes sense.

    Let's call your sprites "HumanPiece". Yes, all the sprites are the same object. You have 4 frames in this objects, each frame being one of your arms or legs (don't forget to set the animation speed to 0). On the sprite object, we add a variable "ClickedOrder", default to 0.

    Now, we start the events. A global variable, "ClickedNumber", set to 0, will remember how many pieces have been clicked already.

    The first event has a double condition, and handles the click :

    On HumanPiece.Click

    IF HumanPiece.ClickedOrder = 0

    => Add 1 to ClickedNumber

    => HumanPiece.ClickedOrder = ClickedNumber

    That way, if a piece is clicked, it won't do a thing if it had already been clicked, but will save what order it has been clicked in if it wasn't clicked before.

    The second event will handle the display of the order. It will only check if "ClickedNumber" = 4, and if it does, will handle what you called the playback. I don't know how you want it to display, but it shouldn't be hard from here, as all those HumanPieces have a variable (Self.ClickedOrder) going from 1 to 4, indicating in what order they were clicked.

    Edit : ninja'd

  • 1/2. : Google is your friend...

    Nowadays, it seems to be the iphone 5 that is the most common, with a screen resolution of 320x568. The link will give you all the details.

    3. : on start of layout=> set scroll to X/Y

    X and Y should then be calculated based on the current displayed resolution

    4. : not sure for this one but I would say that if you only do landscape, use the System.set layout angle action to put it to 90�

  • A simpler way to do it is to use the "Project window", where all the objects, event sheets, layout, resources, ... are listed. Just click on a layout there and its properties will display.

    By the way, in the file I sent you back, I had corrected the sheets assigned to the layouts based on the names.

    It was strange to see a layout for every difficulty level though. It's most of the time just some global variables that change and the system adapts accordingly. Well, this wasn't your problem so let's forget about it ^^

  • You call the variable as you like, it's your program and has no influence on anything else than you understanding your code.

    Should it be 0, 1 or 2? I don't understand that question. If you are talking about the initial value of the variable, there is no need to set one, as it will be overwritten as soon as you use it.

  • To repeat a background over and over again, I advise you to look at the "infinite runner" template, as it implements something similar.

    As for the size of your sprite, the first question is : is your floor always at the same height on the screen ? If so, you just have to check the Y coordinate of your sprite every tick, and set the sprite size accordingly.

    For example, let's say you have some Y1, the max height at witch the sprite will begin to shrink, and Y2 the min height, where the sprite should be 0px tall.

    Then, the event you need is something along those lines :

    System.Every tick (or every X second, X being small)

    | If Sprite.Y < Y1 => Sprite.Set scale (1)

    | Else Sprite.Set scale (1-(Y-Y1)/(Y2-Y1))

    That way :

    • if Y < Y1 => the sprite is full size
    • if Y = Y1 => scale = 1
    • if Y1 < Y < Y2 => the sprite starts to shrink
    • if Y = Y2 => scale = 0 (the sprite is 0px tall)
  • If the file isn't in the project (aka external), you can load it using the AJAX.RequestURL action. You will then be able to handle the response in a text format. Excel could then be hard to read, as the file isn't that much text-friendly. If it is a table you need, then try to use the CSV format instead.

    Last thing, a warning : you have to store the requested file on the same domain as your application. AJAX won't be able to load something from another domain (this is a limitation from AJAX in all browsers : no cross-domain)

  • Only one frame should play ? Just add a variable on the sprite so you can store the current frame (for later) before changing it. Instead of using "Play animation from beginning", start it from a given frame. Use the same triggers, but at the end, start playing from the original frame, using the variable you set at the start.

  • So true... I didn't think of that one... Selecting a layout isn't going into the layout tab, it's selecting it in the project window. You should always check what properties you are changing, the object name is at the top of the property list. In this case, you would have seen you just stayed in the same layout properties.

  • I didn't have any problem changing the event sheets associated to each layout... Here is your file with only that changed.

    capx

Guizmus's avatar

Guizmus

Member since 26 Mar, 2013

None one is following Guizmus yet!

Trophy Case

  • 11-Year Club
  • x4
    Coach One of your tutorials has over 1,000 readers
  • Educator One of your tutorials has over 10,000 readers
  • RTFM Read the fabulous manual
  • Email Verified

Progress

15/44
How to earn trophies