Can't get the disk go right until it hits a wall first.

1 favourites
  • 6 posts
From the Asset Store
The ultimate voice pack filled with 1,536 files of .......wav and mp3 of individual numbers, letters, and words (that go
  • Since I learn best when dissecting demos, today I'm dissecting the pacman demo provided by C3.

    I made the template twice wide. Copied and pasted the entire layout to the right. Worked fine with the key controls.

    Then I changed the controls so the phone tipping moves the disk.

    Up, Down and Left work Great! But Right only works if the disk hits a wall first.

    I setup the tilt controls as I have in every other landscape tilt the phone game I've made. It is in landscape. I locked my phone in landscape mode. But the ball really doesn't want to go right unless it hits a wall first.

    Other than changing the controls, the event sheet is the same as the pac man template on the start screen.

    Any thoughts?

  • Well, that's odd. It seems the problem is which ever directions is on top.

    When I move the go right directions to the bottom of the list, the go down directions moved to the top.

    Now go right works fine, but moving down only works when it hits a wall first.

    c3p file: drive.google.com/open

  • The problem here is that Beta and Gamma will almost never be 0. For example, if you are tilting your phone up, Gamma may be +90, but Beta may be +3. And Beta will "overpower" Gamma, because the event where you compare Beta>0 comes last. And the character will move to the right, instead of going up.

    Basically, you need to determine which direction the phone is tilted the most.

    Try setting "deadzone", ignore small numbers and only move the character when Beta/Gamma is smaller than -20 or greater than +20. You may need to experiment with these values.

    (By the way, on my phone Gamma is left/right and Beta is up/down, not sure why, maybe because I'm testing in portrait mode)

    Also, why did you add 8-direction? It may not work properly together with Bullet.

  • dop2000

    Thank you for your reply.

    I know you used "deadzone" in a demo - I'm going to look that up for pointers.

    What I don't get is why it is only a problem with the direction that is on the top.

    If I move 'Gamma Orientation < 0' (Down) to the top, moving Right starts to work the way it's supposed to and Down starts having issues. It's only the direction at the top of the list, the other three directions work fine.

    https://emailedee.com/wp-content/uploads/2020/03/moveRight3.png

    For testing, the phone must be locked in landscape mode. I have to use an app called 'Lock Screen Rotation'. I am told, that once I export, the actual app will lock the screen into landscape itself and this won't be an issue - fingers crossed.

    I use 8-Direction because beta/gamma has never worked without it, but I'll check again, maybe I don't need it. Thanks.

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • Remove 8-direction, instead of comparing Beta and Gamma with zero, compare them with -20 and +20 ("less than -20", "greater than 20")

    This should improve the controls. But still the best solution is to determine which direction the phone is tilted most, and move the character in that direction.

  • dop2000,

    You're brilliant - every time - I don't know how you do it.

    Now just have to figure out how to keep the phone from falling asleep without the player touching the screen - It's always something (:

    Thank you!

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