oosyrag's Forum Posts

  • (angle(x1,y1,x2,y2)+360)%360

    I forgot modulo! That is a much more elegant solution.

  • Another issue I had a lot of trouble with in the past.

    Method 1 - use families. Have your object in a family, then for each A, if overlapping with family containing object A, destry A.

    If you are using trial version of C2, you don't have access to families. In that case:

    Method 2 - use UIDs to identify/pick an "active" instance, then pick all and compare if overlapping against that specific instance. You'll also need to use for each in this case, so not all A objects are destroyed at the same time.

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • System compare two values. You might not even need that, if you use a message tag that is unique.

  • I've run into this issue before. I ended up using an intermediate function:

    On angle360(x1,y1,x2,y2)

    If angle(params) < 0 | return 360+angle(params)

    Else | return angle(params)

    This will give you the standard 360 degree angles starting from 0 at 3oclock going counter clockwise.

  • I'm pretty sure loops run in their entirety, in order, within the tick it is called before the next frame is drawn... unless specifically broken up to run across multiple frames....

  • For example, if you added another On start of layout event at the top level, it would work. Like so:

    Very common gotcha, not documented in the manual at all, but a pretty well known issue. I wish they would add an explanation somewhere in the manual, maybe in the how events works section.

  • You are using letterbox scale. You'll need to use Scale Inner or Scale Outer and design your views accordingly, as described in the tutorial.

    Also I accidentally posted the second page of the tutorial. Here is the first page, in case you didn't notice it had a first page - https://www.scirra.com/tutorials/73/sup ... zes/page-1

  • Click and drag the tab works for me?

  • I recommend you just roll up your sleeves and do the work of remaking the behaviors you need as events, with the every x seconds condition.

    That said, a workaround is to use an invisible placeholder sprite (seems to apply to a lot of problems). Have this invisible sprite run behaviors as normal, smoothly. Set your visible sprite to the placeholders sprite's position every 0.25 seconds.

  • Try the custom movement behavior - there is a "push out solids" action you can use. You can use this in addition to your physics or 8 direction behaviors, along with the solids behavior.

  • Specifically, are there any techniques/best practices anyone can share for creating/destroying synced objects for multiplayer?

    I understand lag compensation for already created objects - When sending the input to the host, the peer will also move the object instantly, then the game engine will subtly and automatically correct the object's position/angle on the peer based on the authoritative host instance.

    Especially with the 80ms simulated latency built in, projectiles appear in significantly offset locations when the movement of the player is compensated for and the creation of the projectile object is not.

    A related matter is the destruction of objects - it takes a noticeable amount of time for a synced object that should be destroyed to disappear from a peer's viewpoint. I have ideas to fudge this with animations and opacity, but was wondering if there were better ways.

    I thought about creating/destroying the object on the peer side ahead of time, but then the host would create a duplicate due to the syncing. Should I not sync the projectile object at all and create my own system for position compensation (host adjusting peer's objects) via messages? There is also the issue in my specific game where I'm applying a random angle variation on the projectiles for a cone of fire... The host and the peer would not get the same random numbers if they each did their own thing.

  • Here is an example.

    You will use the action Multiplayer: Broadcast Message for the host, and the condition Multiplayer: On Peer Message or On Any Peer Message for the peers.

    Edit: I'm actually not sure myself how changing layouts interact with object syncing, maybe someone else who has experience regarding this can chime in.

    Changing rooms is also an interesting idea, but I think re-associating peerIDs to the correct people could possibly cause a lot of headaches and problems. I assume the peerIDs will change upon entering a new room.

  • Have the host send a message to trigger changing layout on all the peers.

    Then in the new layout, set it up as the tutorial describes where objects are created and assigned to peers.

  • Use Else.

    If A, shoot right

    Else

    if B, shoot left.

    This can get messy if you are doing diagonal shooting.

    Otherwise, I recommend setting an angle for firing direction as a variable, and shoot at that angle. Then you can do 360 degree shooting and not have to worry about shooting multiple directions at the same time.

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

    Waypoints are an ordered set of coordinates. You can save each waypoint in an array in order, then have your sprite move to each waypoint in order based on the coordinates you saved in the array.