How to make a button that stays in the same place

mikbob

  • Posts: 493
I am making a platformer which uses button, how can I make the buttons so that they always stay in the same place on the screen when the actual screen is scrolling?

Visit Our Site!  http://www.mikbobgames.com
Play The Platforms 2!  http://bit.ly/theplatforms2
Check out our twitter!  www.twitter.com/mikbobgames

8bitwit

  • *
  • Posts: 93
There's a good behavior for iOS that's on Forge called "On Screen Button." It has a touched and released state. Just make sure that when you place it in a scene that is larger than the screen size, you place it within the screen bounds. You can view the screen bounds by clicking on the "Show Screen Bounds" in the top right of the scene editor.


Miasmos Games

  • Posts: 878
It's actually just as simple as using the 'Anchor' block. Think it's found under Actor>Position or somesuch. It keeps it at the same place on the screen. :D

Cupcake Bounce

8bitwit

  • *
  • Posts: 93
I mention the On Screen Button behavior because I've noticed buttons can get a bit screwy if you drag your finger off of them while having them pressed down or if there are multiples with just an anchored button type of behavior. The on screen button was coded by Jon I believe.

mikbob

  • Posts: 493
There's a good behavior for iOS that's on Forge called "On Screen Button." It has a touched and released state. Just make sure that when you place it in a scene that is larger than the screen size, you place it within the screen bounds. You can view the screen bounds by clicking on the "Show Screen Bounds" in the top right of the scene editor.


I allready had that applied but I did not know that it anchored. This is because I asked before I actually made a scrolling scene. Thanks!

Visit Our Site!  http://www.mikbobgames.com
Play The Platforms 2!  http://bit.ly/theplatforms2
Check out our twitter!  www.twitter.com/mikbobgames

sylg

  • Posts: 7
Hello,

I'm new here. I've add the On Screen Button behavior to a button. I've made sure its in the "default screen" as mentioned by 8bitwit... But still no button in both iPhone simulator or on my device :(

I haven't change anything in the behavior btw

chers

sylg

  • Posts: 7
Well nevermind, a good night of sleep can do wonders! ;)

I was adding the buttons to the screen bound, but not the starting in ( Starting from top left corner in the scene ).


However, I've noticed there's a bug with the "On Screen Keyboard" behavior where the buttons get stuck in press mode when you test it on an iOS device. Very buggy :( anyone have work around for this ?


Cheers!