Problem with Menu using Camera Scroller Extension on Android devices

TF101

  • *
  • Posts: 51
Hi @ all and a happy new year!

I have a problem with my game menu. I use the extension Camera Scroller http://community.stencyl.com/index.php/topic,57836.msg304666.html#msg304666 for my menu. It scrolls my level buttons smooth.
I have build this for a android device. It works sometimes very strange.
For example: when i swipe faster over the screen the menu disappears.....
The Y of the first button is then "nan" not a number....
Or when i touch outside of the buttons, the menu scrolls some pixels up...


I don't find the reason.....

I have build a example file. Maybe someone have the time and the knowledge to help me, why my menu sometimes disappear...
Download example file: http://templatebase.de/tmp/menue.zip (7.5 MB)

Kind regards,
Thomas

« Last Edit: January 04, 2021, 01:28:58 pm by TF101 »

TF101

  • *
  • Posts: 51
Can't anyone help?  Can someone at least give me a tip how I can create a menu without bugs?  Which extensions can I use for a smooth scrolling?

« Last Edit: January 03, 2021, 02:16:39 am by TF101 »

Luyren

  • *
  • Posts: 2584
If you are using an extension, I can't import your project file since I don't have that extension. You already notice the "nan" value for your Y of the first button when you trigger the issue, so you could investigate from that.

I did manage to make a swipe menu like that without extensions. I make the position of all actors relative to a number attribute, place them on the scene with the correct spacing, and I tween the number by on screen width plus or minus, to move all the buttons to the screen or off screen.

Another approach would be to have an actor which the camera follows, and swiping the screen would tween the actor one screen up or down, showing more of the buttons.
My Stencyl resources are available here: https://luyren.itch.io/
Cutscenes, RPG Elements, Particles, Map System and many more.
Twitter

TF101

  • *
  • Posts: 51
Hi there,
Many thanks for your response.
I didn't understand the first part. I'm too inexperienced for that.  ;)

The second part sounds interesting to me.
I've read something about an invisible actor who can be pushed up and down.
Unfortunately I don't know how to code it correctly.
Is there an example image or tutorial for it somewhere?



Luyren

  • *
  • Posts: 2584
Let's assume your screen only scrolls vertically. When your scene loads, create the invisible actor at the center of the screen.

Your actor setup is straight forward.
-When Updating, move the camera center to self.
-In a swipe Up event , it would be something like this:
Code: [Select]
If not Swiping AND (Y of camera + Screen Height < scene height in pixels)
-Set Swiping to true
-slide actor by X 0, Y [Screen Height] over [Time] seconds
-Do after [Time]
--set Swiping to false
-On a swipe down event, do the same, but on Y you will negate screen height, and the if statement would be something like:
Code: [Select]
If not Swiping AND (Y of camera - Screen Height > 0)
Time is a number attribute, not hidden.
Swiping is a boolean, hidden.

That's one basic idea. So long as you position your buttons in increments of screen sizes on your scene, they will appear to be scrolling as you swipe. You might want to do some math to create the invisible actor at the correct "page" if you want the scene to not start at the very top.

My Stencyl resources are available here: https://luyren.itch.io/
Cutscenes, RPG Elements, Particles, Map System and many more.
Twitter

TF101

  • *
  • Posts: 51
Thank you for the comprehensive answer.  Tomorrow morning I will try to implement the proposal.  I hope I do everything correctly.

TF101

  • *
  • Posts: 51
Thanks again for your help. I was able to rebuild your tutorial. Unfortunately, that's not quite what I wanted to achieve.

I also tested various behaviors.
With these you can scroll the menu but it doesn't look like in "normal" apps. As soon as you let go of the screen, the scrolling stops.

I am amazed that there is no easier way to create a menu in a great program like Stencyl

Luyren

  • *
  • Posts: 2584
I am amazed that there is no easier way to create a menu in a great program like Stencyl
Be the change you want to see in the world. If there isn't already a solution you find satisfactory, make one a share it with the world.

That said, if you say what you want to achieve and what you were able to make given my instructions, I might be able to provide more pointers.
My Stencyl resources are available here: https://luyren.itch.io/
Cutscenes, RPG Elements, Particles, Map System and many more.
Twitter

TF101

  • *
  • Posts: 51
Hello, thank you very much for your answer.

Unfortunately, my knowledge of Stencyl is poor. So I ask the questions. Should I find a solution on my own, I would of course share it with everyone.

What I want to achieve:
A menu that scrolls just like (for example) Facebook or Instagram. The user swipes and the page scrolls and then slows down.

What have I done so far:
A menu that scrolls without an extension. See picture.
What I am missing:

That the page "scrolls further" and then slows down.
I hope I got it right.

I have made a  example without any extension.

Kind regards
Thomas

TF101

  • *
  • Posts: 51
I think I was able to solve the problem.
I used this post as a guide: http://community.stencyl.com/index.php/topic,18745.0.html

The result is acceptable.
I am making the result available to the community here.
It is an actor behavior. Import the Behavior und the Image, place the image inside your screen and attach the Behavior to the image.
I made also a stenyl file. Feel free to use it.