mekonbekon's Recent Forum Activity

  • Ah, I've had something similar happen with local storage - you need to make sure the local storage variable is created and has a value before you can do anything with it, otherwise it will register as Nan.

    This is how I set it up, at the start of the main event sheet:

    System|On start of layout: Local Storage|check item "yourLSVariable" exists
    Local Storage|On item missing: Local Storage|set item "yourLSVariable" to (whatever value you want)[/code:3f4i0lfn]
    
    I also do the following check for if the item already exists and save it to a global variable:
    
    [code:3f4i0lfn]Local Storage|On item exists: set global variable "yourGlobalVariable" to LocalStorage.ItemValue[/code:3f4i0lfn]
    
    I can then work off the global variable instead of referring to the LocalStorage.  At the end of the session I can then save that global back our to local storage if needed.
    
    Another related tip - avoid putting any local storage events on a Loader layout, if you have one; I believe that once the game has downloaded once, the loader layout doesn't always play, in which case it would skip all those events.
  • orinab

    I am not a fan of wait actions. Because while you are waiting, you might need to change what should happen next.

    Heh, was just about to say the same thing, then noticed you'd posted: unless absolutely necessary I'd avoid waits, they have a habit of creating all sorts of problems unless used very carefully. If there's an alternative I'd use it - any of the other solutions mentioned here would be preferable.

  • Glad to have helped

  • You could get around it by creating a 2-D array and adding the names of the tags for a group of sounds to a column/row - this would allow you to place a sound in multiple groups.

    When you want to affect all sounds in a group you could then run a loop on that group, pointing the tag field in the relevant audio action.

    e.g.

    you have sounds tagged "sfx_A", "sfx_B", "sfx_C", "sfx_D"

    array_soundGroups has three groups of 3 sounds:

    0: ("A", "B", "C"),

    1: ("B", "C", "D"),

    2: ("D", "B", "A"),

    To turn off group 2:

    for "i"=0 to array_soundGroups.Height-1)

    stop sound tag "sfx_"&array_soundGroups@(2,loopindex("i"))

  • How about instead of creating a new thin red line object you:

    Add a new frame or animation to the platform object that includes the line graphic.

    Also add the fade out behaviour to the platform object.

    When the coin is collected switch the animation for all platforms.

    When the player collides with a platform you can then check if the new animation is playing. If so, start fade out behaviour for that platform. Make sure the "destroy on fade out" setting is set for the behaviour and the platform will automatically destroy once it's completely faded.

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • First you might want to use str(floor(random(3)) otherwise you won't be getting a whole number and you would never get animation "2". Alternatively, use choose("0","1","2")

    Also, have you tired separating out the set animation into a Create object event?

    e.g:

    On start of layout

    repeat 10 times: create object X

    On object X created

    set animation to str(floor(random (3))

    Using the "On created" can get around a bunch of other problems that can arise when trying to set variables and states of created objects immediately after they've been created but before they've been drawn.

  • Preloading will download sounds into memory so that they play as soon as they're called - if they're not preloaded then when they're called there might be a delay before they play as it will take a little bit of time to download them.

    By default, sounds are automatically preloaded when the game is initially downloaded by the user but you can turn this feature off in the project settings - you may want to do this if you have lots of sounds and would like to reduce the initial loading time - you could then preload groups of sounds on a level-by-level basis, for example.

    Sounds take up space in memory, so if you have lots of sounds in memory that aren't going to be reused and your game is particularly memory hungry then you may want to clear up some space by unloading them. I assume that unloaded sounds would then need to be re-downloaded if they are called again.

    Hope that helps

  • Hi, I think you can use MoveTo's "On hit target position" condition:

    On start | wait 2 seconds; Move object to (x1,y1)

    On object hit target position:

    >If position = (x1,y1) | move object to (x2,y2)

    >If position = (x2,y2) | move object to (x3,y3)

    ...etc.

    Hope that helps!

  • You can use the Audio "Play at Object" action in the Advanced Audio sub options

  • If the non-player object is simply performing a ping-pong movement left and right it might be better to remove the platform behaviour and either:

    1) add another sine behaviour set to horizontal movement

    or

    2) give the object max_X, min_X and speed instance variables then add code along the lines of:

    Every tick object.X = self.X+self.speed

    If object.X > object.max_X OR object.X < object.min_X, trigger once, object.speed = object.speed*-1

  • The player sprite doesn't need solid, just platform behaviour.

    The floor doesn't need physics, just solid.

  • Try:

    Hero is on floor

    (sub event) Right arrow is down OR on touched object

mekonbekon's avatar

mekonbekon

Early Adopter

Member since 9 May, 2014

Twitter
mekonbekon has 13 followers

Trophy Case

  • 10-Year Club
  • Forum Contributor Made 100 posts in the forums
  • Forum Patron Made 500 posts in the forums
  • x2
    Popular Game One of your games has over 1,000 players
  • Famous Game One of your games has over 10,000 players
  • Coach One of your tutorials has over 1,000 readers
  • RTFM Read the fabulous manual
  • Great Comment One of your comments gets 3 upvotes
  • Email Verified

Progress

18/44
How to earn trophies