How do I disable specific inputs on controls

0 favourites
  • 13 posts
From the Asset Store
Supports keyboard, mouse and gamepads. Supports several gamepads at once.
  • I've tried what should be working which is set a variable below "button is pressed" so it only simulates movement when those conditions are met as seen in this entry and you can check the capx, I set a variable when the character is on the wall and remove it when it's not, however this isn't stopping the problem of being able to hold against the wall and just slide up it without leaving the wall. I mean it SOMETIMES shoves me off the wall but I want it to act as if that button doesn't exist for the duration, and furthermore I can fully control it when it leaves the wall instantly even though I set a 2 second delay on the variables.

    I don't even know what to do with this, I can't find any tutorials on walljumping proper and the topics on disabling controls say to do exactly what I did which didn't work at all.

  • [quote:2cbt7wck]this isn't stopping the problem of being able to hold against the wall and just slide up it without leaving the wall

    Do you mean when it's sliding up the wall for about 100px before it starts falling down?

    I think this is not because you continue to hold any button, but because the jump is too high - you decrease the gravity by more than a half, so the character keeps accelerating up.

    The way you are disabling buttons by adding another condition like "wallToLeft=0" is perfectly fine.

  • well the gravity thing I made do on purpose. I'm talking if you are on the wall you can hold up and towards it and tap away and never leave the wall, you won't be pushed away from it and I want the character to be pushed away from the wall as if they were jumping between walls.

    I wanted to implement a limit to how long people can walljump in a way that feels natural but you can stay on the wall infinitely just holding against it and tapping away, so long as you're holding the opposing button you won't be stopped.

    furthermore I know that I'm doing something wrong because of the 2 second limit, it should disable controls for that long but it doesn't, I can very quickly hop back on the wall if I jump off of it.

  • [quote:2us7wkbf]I wanted to implement a limit to how long people can walljump in a way that feels natural but you can stay on the wall infinitely just holding against it and tapping away

    Sorry, your wording is a bit unclear - do you want to allow players to stay on the wall infinitely? Or is it a bug and you want to get rid of it?

    I made a few changes, have a look:

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

    It still may need some tweaking, also you can move repeating code to functions.

  • wow you're up late. do you think you could cap what you're changing? I'm on a weird setup where I'm working (don't tell nobody) so the computer I'm working with this stuff on has no internet and the computer I have internet on I'm not allowed to download or insert flash drives into so I won't be able to preview the cap for another 4 or so hours.

    also yes it's a bug, but I'll tell you what I've discovered since then.

    this was happening on the right wall because I forgot to flip an abs to negative so as I went up the wall faster the jump got slower. it actually was trying to push me off the walls but I'd goofed in coding so it actually kind of works without those now

    however I'd still like to know how to disable the input as the same detector that works marvels to set the gravity and slow fall speed so I know that works wasn't disabling the controls and if it was it's not respecting the 2 second timer.

    I'd update the capx but I really just changed the "set vector x" to -abs(yaddayda) on the right wall and then toned all the numbers WAY down because of how high I'd put them thinking the jumps just weren't strong enough.

  • I live on another side of the globe, it's not very late here yet

    I changed too many things, but I think it works much better now. It doesn't allow to stay on the wall for too long and the height of wall jumps decreases with every consecutive jump.

    You'll see in 4 hours

  • nooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooo

    kay

    oh hey, while you're in the capx, I have a bit of disabled code down in the das kamera tab that was giving me troubles. I'm trying to make it zoom fluidly as well as pan to the character with lerp since that part worked beautifully. I haven't tried this iteration since I was working on other stuff but it either made it zoom too far out or too far in infinitely before for some reason...

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • You mean something like this?

    Screen zooms in (up to 1.4) when the player is stationary and zoom out when moving (down to 1).

  • dang that's polished. double lerp though I'm starting to get the sense this engine has way more below the surface I've yet to see...

    also you stuck the abs and lerp before the divide on layoutwidth...

    mayhaps I was dividing by zero and staring into the void created?

    actually after messing with the numbers a bit I don't quite understand how those numbers work. I tweaked the min and max but raising the max to 2 from 1.4 for more zoom out actually caused everything to zoom in more, and conversely reducing the minimum zoom to say 0.5 made everything zoom out more in the end...

    also changing the 1 in zoom max didn't raise the max zoom levels as I'd thought but again zoomed everything in...

  • Yeah, you need to be careful with the void

    Frankly, this is the first time I'm playing with smooth zooming/scrolling. I should add something like this to my game.

  • boop you replied while I was editing

    and the camera is somewhat bouncy and disorienting, which is pretty fixable by slowing the camspeed down or dividing it in the lerp and increasing the distance between min and max zoom so it's more forgiving, though i'm already thinking of how I can set it to have some give room so it only zooms and pans after a certain distance is moved and then lerps to it so it remains completely unmoved in a sort of moving dead zone.

  • maybe a logarithmic lerp speed? I'm to sleepy gotta get some shuteye...

  • First line determines zoom level - from 1.4 for stationary (zoomed in), down to 1 when player's speed is equal to layoutWidth (zoom 100%).

    If the player is moving even faster, zoom can become <1. I didn't want that, so I added zoom=max(zoom,1)

    I don't like this zoom effect either, you should definitely play with the values or camera speed etc.

Jump to:
Active Users
There are 1 visitors browsing this topic (0 users and 1 guests)