Scrolling problems

For questions about using Classic.

Post » Wed Sep 23, 2009 3:53 pm

I need some help...

I going to make a scrolling system like this:
If mouse x position is equal to screens x position
then screen going to move screens x position + 10 px
and if mouse y position is equal to screens y position
then screen going to move screens y position + 10 px

I tried, but can't understand how i gonna do it... :oops:

I hope you can help me. :)
B
1
G
3
Posts: 2
Reputation: 829

Post » Thu Sep 24, 2009 1:23 am

For scrolling to the right:

New event - System - compare. So then you can compare the two values: "Get mouse X" and "Get X right of visible screen". Which will check if the mouse is on the right edge of the screen.

action - system - scroll to X. Then you want to retrieve the current "Get scroll X" then add 10 to it.

and you'll end up with this:




however I made it so that if your mouse is within 10 pixels of the right edge, by checking if the mouse is greater than right edge -10 pixels - because it's too annoying to try and get the mouse to exactly the right edge.

B
134
S
65
G
16
Posts: 1,766
Reputation: 19,190

Post » Thu Sep 24, 2009 4:28 am

Try using the Follow Mouse behavior on a sprite and centering the screen on that sprite or however you intend to do your scrolling base it off that sprite (you can make it invisible or part of the GUI.) Though you'll need to work out a system of adjusting the speed, you know how with the WII remote it wasn't a 1:1 ratio. That may just have been what I was trying to do with the Mouse behavior when I tried it out though.

I keep saying sprite, but a tiled background should work just as well for most stuff.
B
2
S
2
G
3
Posts: 114
Reputation: 1,553

Post » Thu Sep 24, 2009 5:13 pm

Thanks, It worked :D
B
1
G
3
Posts: 2
Reputation: 829


Return to Help & Support using Construct Classic

Who is online

Users browsing this forum: No registered users and 5 guests