randomly's Recent Forum Activity

  • Nandynho

    andykenobi

    When I use the prompt alert, SweetAlert2.GetLastValue returns a c2array..

    Is that normal? And how do I get the input with tokenat?

    (Currently, I'm using an array and load it from the c2array json and get the value from the array then. There must be an easier way, right?)

  • The current Turret behaviour can't use frames to animate the rotation.

    You will have to do the rotation yourself.

    Take a look at this .capx:

    Download .capx

    The bullet angle is a bit off, but we could correct that with a dictionary or some advanced calculations.

    (If you want, I can show you how)

    (By the way, your initial Animation strip missed a frame between 24 and 25, I replaced that with a duplicate of 24 to correct the calculations. And I also corrected the origin of the bullet sprite, it was a bit off)

  • Alright, this is quite a challenge, since Tilemaps don't give you the X and Y index on collision.

    (Which is very unfortunate, I don't know why that doesn't exist..)

    Anyways, here is a workaround:

    Download .capx

    Some notes concerning the .capx:

    • It's far from perfect
    • It creates multiple instances of the sprite on collision, because collisions, 8direction and tilemaps apparently don't work very well together
    • If you have any questions (might look very complicated on the first look), don't hesitate to give me a shout.
  • Alright, assuming you don't help with the swipe input, this is what you do:

    On right swipe:

    On left swipe:

    (Replace 300 by the speed you want. Alternatively, replace the whole "set speed" to "set acceleration", if you don't want immediate movement)

  • Sorry about that, I edited my post, link should work now.

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • Your capx would be very helpful here.

    Anyways. You should probably give the client some time to disconnect from the server before restarting the layout.

    If that doesn't work, I'll need your .capx for further investigation.

    Since your game apparently connects normally when you start it first, there doesn't seem to be an issue with your code.

  • You say, you want to make it "hard as steel".

    The revolute joint is not made for that.

    The revolute joint only restricts the relative angle between the connected objects.

    It looks like you want to create a line of sprites right?

    What you need is a distance joint or, even better (because less CPU consuming), the Pin to behaviour with the rope style.

    Try those out.

  • To get the position of the tile, you can simply use the tile's expression:

    Tilemap.TileToPositionX(X index of tile)
    Tilemap.TileToPositionY(Y index of tile)[/code:dyk8a1uo]
    
    It also works the other way around:
    [code:dyk8a1uo]Tilemap.PositionToTileX(x coordinate)
    Tilemap.PositionToTileY(y coordinate)[/code:dyk8a1uo]
    
    It gets harder if you want to spawn the Sprite at the exact point of collision, you would have to calculate the point of collision manually.
    See [url=https://www.scirra.com/forum/how-do-i-retrieve-collision-point-coordinate_t121791]here[/url] for further information.
    
    If it's possible in your project, you can also use a workaround, for example using the coordinates of the colliding object to spawn the sprite.
    
    If you could provide further information to the context in your project, maybe we could find a workaround.
  • I don't think I fully understand what you are trying to do.

    Do you want to spawn a Sprite at the position of a tile when that tile is added or changed?

  • So you want to this?

    • when you swipe right, the player moves to the right
    • when you swipe left, he moves to the left
    • when you swipe in any direction while he is moving, he changes directions?
  • Oh, I'd love to use this in my game...

    Would be awesome for flashbangs..

  • Just discovered this thread again and realized I didn't answer yet. Sorry about that.

    Did you solve your problem?

    If not, here is a possible solution:

    (Prerequisite is, that each player sprite has an instance variable with the players Multiplayer ID. You could set this "on connected" or when the sprite is created)

    • If the host gets the info that a player starts walking, he needs to get that player's ID with the message (Multiplayer.FromID).
    • The host then sends out a message with the tag being "walk" for example to all peers with the content being "playerID=[...]".
    • The peers, on receiving a message with the tag "walk", will set the player's sprite to the walk animation. (it picks the correct sprite by evaluating the received PlayerID and picking the corresponding sprite that has the same PlayerID as its instance variable)

    That's it.

    This may sound like much, and I have the feeling that I didn't explain very well (I'm about to go to sleep), so if you need more explaining, just give a shout.

    (And if you already solved it, I'd be interested in how your solution looks like)

randomly's avatar

randomly

Member since 26 Sep, 2016

Twitter
randomly has 1 followers

Trophy Case

  • 8-Year Club
  • Email Verified

Progress

9/44
How to earn trophies