randomly's Forum Posts

  • 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.

  • 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)

  • Probably didn't find out the issue, but thought I'd contribute.

    I exchanged the TiledBackground object with a regular Sprite which seemed to reduce the inaccuracy.

    Might be a bug or an issue with the TiledBackground object.

    With TiledBackground:

    With Sprite:

    [EDIT:] Probably found the issue.

    This is what it looks like when disabling the collisions of the Player Sprite:

    Maybe you can change your program with that information or submit a bug thread?

  • Here you go:

    .capx Download

    I included two variants:

    • a lerp variant which emulates acceleration by using lerp
    • a custom movement variant which is quite complicated because of all your needs ;)

    The .capx is fully commented, I hope you understand everything and I also hope, I understood correctly what you need.

    In case you have questions, don't hesitate to ask.

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • This is a real tough thing to program and that's probably why you didn't get any responses yet.

    If you are trying to do this as a hobbyist, you would probably be better off trying to control the input by a different system.

    This requires a really good, strong and complex algorithm. It is possible, but the only useful stuff I found when googling for this was by university professors. (e.g. here)

    If this is doable at all, there are probably just a few people in this forum who can help you, most likely

    I don't want to crush your "dreams", but I think you would make life a lot easier for yourself if you considered a different approach.

  • There you go:

    https://dl.dropboxusercontent.com/s/y4d ... atsUp.capx

    This is only sending stuff, not including receiving messages.

    I did it as fast as possible, since you are apparently in a hurry.

    But adding it won't be hard.

    (if you need help though and got the time, tell me)

    [EDIT] Updated link to .capx with requested scrolling

  • Sorry, but we have a private life too and don't spend our time waiting for someone to post a thread to answer it immediately.

    I'm working on it, just so you know.

  • You would simply add a sprite and add an event

    "Player: On collision with [Sprite] --> Player: Bullet: Set speed to 0".

    But I have a question though:

    why would you use bullet for the player movement?

    Why wouldn't you use "platform", "custom movement" or "8 direction"?