oosyrag's Forum Posts

  • Firstly, array as JSON:

    https://www.scirra.com/manual/108/array

    AsJSON
    Return the contents of the array as a string in JSON format. This can later be loaded in to the array with the Load action.
    
    Load
    Load the contents of the array from a string in JSON format. This must have been retrieved from either the Download action or the AsJSON expression. It could also be retrieved dynamically from the AJAX object.[/code:2lnb9dg4]
    
    So using the Array.AsJSON expression will give you the entire contents of an array as a single string. You can save this string to a variable, file, localstorage, firebase key ect.
    
    Loading that same JSON string will populate the array with all the information that was saved.
    
    About the multiplayer plugin, you would make your own login system. Peers can send a message to host, such as login information, and your host can pass back information to the peer (like the player's game data array in JSON format) after confirming the login info. Again, this is assuming you will have one dedicated host always running on a server.
    
    Regarding Firebase, sorry I'm not too familiar with the specifics so I can't help you much with details. I just have an idea of the general concept of using it, and haven't worked with it myself yet.
  • EDIT: Removed Link.

    As mentioned furthur along in the thread, this method is actually pretty terrible in terms of efficiency and should not be used :p

    Psuedocode:

    While a 1 exists in the array, pick a random array cell between 0 and Array.Width.

    Does the random cell contain a 1? If it does, add one to it and stop the loop.

    Otherwise, repeat.

    If you want to expand this to a 2d or 3d array, you'll use a similar method, but randomly pick XYZ coordinates instead. Not recommended because you will no longer be able to use IndexOf to confirm if the target value exists in the array, and can end up with an endless loop.

  • At the simplest level, Firebase is just an online database you can use to store and get information.

    For a MUD type game, you might not even need to use the multiplayer plugin if you are using Firebase, depending on your setup. Basically each player will upload their own information and request data from the Firebase server as needed, thus getting information on all the other player states.

    Otherwise, utilizing the multiplayer plugin, you would probably have a dedicated host which all peers connect to that handles all information. Then you wouldn't need Firebase...

    To proceed with Firebase, you'll want to answer the questions: What does each peer need to know about other peers, and when do they need it? What information needs to be saved? Then its just a matter of syncing the relevant information to Firebase.

    Generally speaking, if you can organize it properly, keeping all information that needs saving in an array would allow for a relatively simple import/export system via Save and Load Array as JSON (which is simply a standard format for saving certain types of information).

  • Add an instance variable to your EnemyBullet called "source". When you spawn your bullet, set EnemyBullet.source to EnemyShip.UID. Now every bullet has an identifier for which ship it came from.

    When destroying the enemy ship, add a sub event to pick all EnemyBullet by UID - EnemyShip.UID, then destroy EnemyBullet. Only the picked bullets well get destroyed.

  • XML sounds like the way to go.

    https://www.scirra.com/tutorials/search?q=xml

    Parse it into an array, and you'll have all the information available to you for use.

    Although you can't dynamically create object types at runtime, you'll have to set those up ahead of time.

  • Right click the sprite font and select clone.

    Although you really should just use a single spritefont object and learn how to pick the proper instance to manipulate instead. There are many ways of doing so.

  • Don't be intimidated by arrays! They are simply little spreadsheets with a bunch of tools you can use to manipulate them.

    The solution to update the array is simply to repeat the actions called on start of layout, with the simple addition of setting array width to 0 beforehand to erase the current array. So upon dropping a block, set array width to 0, then add each block's (new) x position and uid to the array again and sort by x position.

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • I think the multiplayer plugin could work too, have the program automatically connect to a host which would pass a certain variable back to the client to save in localstorage for a certain amount of logins. This can happen in the background and be non-critical for the function of your program. You can have this event run only before a certain date to future proof it, and or patch it out later in an update.

  • Try a horizontal sine behavior movement with increasing magnitude and speed while applying a steady upwards acceleration as well.

  • You would use it as an expression in the System - compare two values. First you would have to pick the powerup (I'm guessing by colliding), then you would system compare two values Powerup.AnimationFrame = x?

    The condition Isplaying is a little bit not quite right for your situation, so I recommend optimizing it a bit more even if it works as you have it right now. Just in case to prevent future issues.

  • Your question is a bit unclear....

    But try adding the "Every X Seconds" condition to your event to have it keep firing.

    Alternatively, add Wait and additional Spawn Bullet actions if you want a fixed number of bullets.

  • Generally speaking, when you click your button, you will need to "pick" your tower to be upgraded with conditions, so that your upgrade action only applies to the picked tower. There are many ways to pick, depending on how your project is set up.

    A safe way is to pick by UID, which you can save to a variable as an action when you select a tower to begin with. I recommend storing this in an instance variable in the upgrade button. Let's call it SelectedTower.

    On tower selected (on clicked/touched?) - Set instance variable Button.SelectedTower to Tower.UID

    On upgrade button clicked,Pick tower by UID Button.SelectedTower - Do upgrade tower action

  • I'm not sure if it works, but does rotating the layout affect gravity?

  • Use a 1 pixel width line stretched from each data point to the next. Set length and angle with a little math.

    Or use the Canvas third party plugin to draw lines.

  • I'm assuming this has to do with interacting with objects under your ui elements rather than a visual thing... as you shouldn't be able to see your objects if there is a ui on top of them anyway.

    As long as they exist, they will be under there, so you may want to add a condition to check if there is any other UI under your mouse click/touch as well before doing the action. A UI Family would be useful for this. For example, on touched object, is NOT (right click a condition to invert) touching UI (family) - then do something.

    As for scroll to, you can use scroll to position instead of scroll to object to get an offset. For example, Scroll to PlayerX+100, PlayerY would give you your player offset 100 pixels to the left of center.