sweetdiss's Forum Posts

  • I will probably have to go with the other method, but the “dragging the view” method I was trying here did have advantages: You can control the speed of the dragging (like in your example) so the user could control how sensitive the dragging is. Also if I have enemies pinned to the level firing bullets, the bullets would move at the wrong speed relative to the player object, unless it’s the view being dragged around.

    Thanks for the help though, your website seems like a great resource!

  • See this demo project:

    https://howtoconstructdemos.com/scroll-by-dragging-the-screen-with-touch-or-mouse/

    Thanks so much, the dragging/scrolling is perfect now!

    However there is now a new issue. In my project the player stays in the center of the screen (based on the viewport), but when I pan the view back and forth, the player gets really jittery and lags behind the panning slightly.

    I tried to fix this by setting a camera object on a separate "hud" layer and anchoring it to the center without parallax to have an object that is 'perfect' (no jittering), and then setting the Player to always be at the same X axis as that object, but it didn't work. I suspect you can't have objects interacting from different layers.

    Is there any other way to keep my character jumping in the center of the screen, while the view pans around, without jittering?

    Here is another link to the (updated) project.

    drive.google.com/file/d/16iLFCraaD_uxVoGWcS6ypj20Qnmch3-s/view

  • I'm trying to make my layout appear to scroll the same way my finger is dragging the camera, as if I were directly dragging the level itself.

    I found this older thread that seems to provide a solution to what I want to achieve with respect to the camera behavior:

    construct.net/en/forum/construct-3/how-do-i-8/scroll-opposite-direction-drag-151132

    However, when I tried to implement it in my project, nothing happens. The dragging/panning of the camera still goes in the default direction/speed.

    It seems like I'm missing something really basic because there is literally no difference when I toggle the added action on/off.

    Here is my project:

    drive.google.com/file/d/16iLFCraaD_uxVoGWcS6ypj20Qnmch3-s/view

  • Thank you, I’ll give that a try!

  • Line of Sight has Raycasting.

    Hmm... can you elaborate? Sorry, I’m pretty new to game development!

  • dropbox.com/s/2jw2ldko78dt4hz/pushit.c3p

    Thank you! However I noticed if you resize the walls and try to go through them on the opposite side, the player square is able to pass through.

    The walls in my game aren't just at the edges like in your example, they will be all over the place in different formations. Is there a way to make every side of a wall "solid" so the player won't pass through no matter what side they are on?

    Thanks again for the help!

  • I'm using drag/drop to control a character in a game I'm making, but unfortunately it allows for solid objects to be dragged through each other, and I can't have my Player going through walls.

    One solution I've read about is using "Move To" to re-create drag-drop behaviors, which should allow collisions to happen between solid objects.

    It seems like it should be simple to pull off, but I can't quite wrap my head around it.

    The way I'd like it to work is to have the object move relative to wherever I touch and drag (so you don't actually have to touch the player object, and I also don't want it to zoom over to where I'm touching).

    The best I can do on my own is this:

    + System: Every tick

    + Touch: Is in touch

    -> Player: Move to (Touch.X-Player.X, Touch.Y-Player.Y) (Direct)

    drive.google.com/file/d/16iLFCraaD_uxVoGWcS6ypj20Qnmch3-s/view

    As you can see there are a few problems. Namely:

    - The object moves just from tapping and holding, even without any dragging

    - When you do drag on the screen, the object moves kind of slowly and is not as "snappy" and responsive as the real Drag-Drop behavior

    - Also, after dragging, tapping anywhere just sends the object scrolling off the screen forever

    Thank you!

  • Sorry to bump, just wondering if anyone else has any ideas to fix this?

  • Post a copy of your project (as a single .c3p file) with clear reproduction steps of your issue and it will make it easier to be able to answer your question.

    drive.google.com/file/d/1-MLn4d0Ki72nUBrdgL5fMlXW9Acp6Bzs/view

    There is the link to my project. It was designed for touch but works fine with mouse. The problem is a conflict between Event 23 and the main mechanic of the game set up in Event 19.

    The main mechanic is dragging the level (all the platforms as one) under the Player as they repeatedly jump in order to get the player to jump through the portal at the end.

    Unfortunately, when you drag a wall into the player, it pushes the player around. I need them to stay in the center of the screen for the mechanic to work properly.

    To fix this, I added Event 23 which fixes the Player in the center of the screen (horizontally). The new problem is that the wall just goes right through the player now even though they are both solid objects.

    The desired behavior is that the wall (the entire level, really) would STOP moving if it was dragged into the player, as if the player had jumped against a... well, solid wall. The idea is that you time your dragging to slide the platforms/walls under or over the jumping player to avoid them.

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • Ah I just reread it... I’ll look into the “trigger once” thing! Thanks again

  • 'On collision' with spike is a trigger event and runs the function once. 'Is outside layout' runs every tick so repeats the function up to 60 times a second. You can fix it by adding trigger once condition to 'is outside layout'.

    Thank you! Is there a way to turn the “out side layout” check into a trigger event? Or another way to accomplish the same thing?

  • I have a PlayerDeath function that I call when my Player object hits a spike or falls off the screen (out of layer bounds).

    Inside the PlayerDeath function is a Wait command in order to display the Death animation, screen shake, and sound effect before restarting the layout.

    This works perfectly when hitting a spike.

    But when the player falls off-screen, the PlayerDeath function plays the sound effect repeatedly at the same time (so it sounds much louder). This behavior doesn't happen with the spike, even though the Spike collision and the falling off-screen both call the exact same PlayerDeath function. I'm not sure what the difference is and why the spike collision works perfectly but falling off the screen does not.

    I've included a picture of the PlayerDeath function (I'm very new so apologies if the code is amateur).

    The way I'm calling the function is either:

    Player -> Spike collision: Call PlayerDeath

    or

    Player -> Is outside layout: Call PlayerDeath

    Why does one work perfectly and the other causes the sound to mess up?

  • Hello again! I've got a platformer where the player stays fixed in the center of the screen (horizontally) but moves up and down. You move the player object through the level by panning (dragging) the level itself back and forth. This works great, but when the player comes to a wall, the wall just pushes the player back, sometimes even off-screen if you drag far enough.

    I fixed this by setting the player position to X = 240 (center of the screen) for every tick. Now the player stays fixed in the center like I want, while still moving up and down.

    But now the walls just move straight through the player even though they are both solid.

    What I'd like to happen is for the level to stop panning when you try to drag it through the player.

    Here is a visual of the level:

    (Ignore the swirl on the player, that's an effect for the end of the level)

    When I pan that wall to the left, into the player, the wall is supposed to STOP moving. The idea is to wait until the player goes up or down and THEN you pass the wall under/over the player to keep moving, but as I said this doesn't work. Now that the player is fixed horizontally the walls/player just pass right through each other.

  • Try this:

    .

    That worked perfectly! Thanks so much.

  • In my platformer, I have the player staying in the center of the viewport and you move the level around him/her, essentially making the character move to the end of the level by panning the level itself.

    My "level" is a bunch of platform sprites pinned to a large invisible object that you can drag back and forth.

    Since the camera/viewport is fixed on the player that never moves horizontally, the built-in parallax for backgrounds doesn't work (as the layout is not technically moving).

    I have a tiled background on another layer and I'd like to make it scroll along with the "level" object being dragged, but obviously at a slower rate to simulate the parallax effect.

    What might be the simplest way to accomplish this effect? (I'm still super new at this!)

    Thanks!