oosyrag's Forum Posts

  • Your target/source text should be Test2, and your length should be based on your visible text Test, so you have those swapped. Also, your Test object needs to start out empty. That expression says set Text to whatever the length of Test was originally +1 character, so if your original text starts out already longer than your target text, you won't get the typewriter effect.

  • Use a global variable, or add the persist behavior to an object.

  • Array.At(Array.IndexOf("WeaponName"),1)

  • https://www.dropbox.com/s/mvv1sihhfe9mh ... .capx?dl=0

    As you can see there is work to be done regarding character spacing, but I did add in line breaks for you.

  • Sorry off topic, but this is the literally the greatest thing I've seen lately haha.

  • Got an example capx of what you've done? There are quite a few possibilities and it would be a bit silly just to guess from your description alone.

  • How many json files do you have? Straight forward way is to create a function with an event for each file: if param=0, load a, param=1, load b ect... Might be a bit tedious if you have a ton of files, but you only have to do it once.

    Edit: and then call the function with floor(random ()) for the parameter

    Edit 2: answer below way better.

  • Positioning by code is much less tedious than you might imagine. Breaking up a string into it's constituent characters into an array is just one single looped event, and placing them all as sprites again is another.

    It gets more complicated when dealing with individual spacing between characters (depending on the width of the character) and line breaks. Those can be handled based on your requirements though.

    Sorry don't have an example for you right now but if you have trouble figuring it out and don't mind waiting I can put one together pretty quick when I get to a computer tomorrow.

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • Create an array, width set to the size of your number pool (100), height and depth 1. Populate the array with the numbers 0-99, an easy way to do this is:

    Repeat Array.Width times - Set Array at loopindex, to loopindex[/code:37glqkyh]
    Now to pick a number out of the array, use a variable (I would make it an instance variable for the array) called PickedIndex. Also one more (global) variable to save the number that got picked.
    
    To pick a number, you can use:
    [code:37glqkyh]Set PickedIndex to floor(random(Array.Width))
    Set PickedNumber to Array.At(PickedIndex)
    Array - Delete Index PickedIndex[/code:37glqkyh]
    
    In summary, this picks an index from the array based on the size of the array (so it works even when it starts shrinking), saves the value at that index, then deletes that index so you won't be able to get that number again next time.
    
    The troublesome part for you now is to create a set of events to determine which object to spawn based on that number (there is probably a better way to do this, but it evades me at the moment). Highly recommend putting this set of events in a function you can call, with the parameter being which object to create. Note this is actually 0-99 now, rather than 1-100. You can do the latter simply by using loopindex+1 instead when populating the array.
    
    To reset the number pool, resize the array to what you want it to and refill it as done above.
  • So non repeating random. This plugin may be of use

    First though, some advice setting up. Are your Sprite objects unique in that they need to be separate objects? This will be significantly simpler if you were able to use one object with 100 different animation frames as opposed to 100 different Sprite objects.

    Otherwise I think you may need an event for each unique object. Roll a value from 1 to 100, if 1, create object a, if 2 create object b, ect...

    Edit: let me know if you want to avoid using plugins, a similar way to get non repeating integers from a range can be done with arrays as well, but it will be more complicated. Still relatively simple if you are comfortable with arrays though.

  • Put your sprites into a family.

    On click button

    Repeat 8 times - create object family.

  • Browser.ExecJS("Date.now()") will give you the system's Unix time in ms.

    To get seconds, divide by 1000 and round. You should save this value to local storage every x seconds, and compare the current Unix time with the saved time upon resuming the game.

  • Sorry don't have an answer off the top of my head. I'll experiment a bit when I get the chance to see if there is anything that can be done.

  • Sometimes, it pays off to not be too strict about authoritative host when certain requirements need to be met. Bullet spread is definitely a classic problem for real time multiplayer shooters. There are many approaches, for different situations.

    1. Fudge the local visual. Example - Counter strike - the bullet holes a player sees doesn't necessarily mean that's where the server decided the bullet actually went, even if they have the same constraints. It is an illusion, but doesn't necessarily affect game play significantly. For a third person view like yours, this works especially well if you have an "accuracy" type system as well, where a bullet passing through a sprite has a percent chance to do damage or "hit". Running with Rifles is a good example. If it is known the enemy has a chance to not get hurt even if it looks like they get hit, they will be more accepting of fudging done due to mismatching host/client visuals.

    2. Use a seeded random. A possibility, but not recommended with something as numerous as bullets across multiple peers.... Keeping the order synced sounds like a nightmare to me, but I haven't tried it so I might be wrong.

    3. Best for slower projectiles - Have the local input prediction fire off a bullet sprite with 0 angle, and after it receives the actual angle from the host, start correcting the course of the local bullet. The slower the projectile, the less distance it will travel before getting the actual angle, making it not really noticable. There would only be a slight discrepancy near the origin, where the angle has the least impact anyway.

    I think for your particular situation you have two best options - just fudge the player's visual feedback and accept that it might not be "real", or allow the peer to be authoritative on the angle of the shot.

    An additional nice touch is to have seperate feedback for a host determined "hit", like blood or flashing some other indicator. Then even if it looks like a bullet passes through the enemy, if they don't flash maybe it can look like the bullet went by them (above?). Also if it looks like the bullet missed, but host determines a hit, at least the player will get some feedback that there were hits.

    Lastly, the less possible bullet spread the easier it is to fudge acceptably in general, which may be a consideration.

  • I have no idea. Try it and find out.