The Daily Click ::. Forums ::. Klik Coding Help ::. how to do this type of scrolling
 

Post Reply  Post Oekaki 
 

Posted By Message

Jon C-B

I create vaporware

Registered
  23/04/2008
Points
  237

I'm an alien!VIP MemberWii OwnerI donated an open source project Santa Hat
3rd June, 2010 at 19:10:26 -

I need to be able to do normal scrolling, but make it so that it stops scrolling when it hits a detector. I tried multiple things but they didn't work. Any help?

 
n/a

Sketchy

Cornwall UK

Registered
  06/11/2004
Points
  1970

VIP MemberWeekly Picture Me This Round 43 Winner!Weekly Picture Me This Round 47 WinnerPicture Me This Round 49 Winner!
3rd June, 2010 at 19:32:28 -

How about using a fastloop to always move a detector object (which the screen is always centered on) towards the player; then if it hits one of your other detectors, you stop the loop. Or you could do the same thing using the "move safely" extension.

 
n/a

Jon C-B

I create vaporware

Registered
  23/04/2008
Points
  237

I'm an alien!VIP MemberWii OwnerI donated an open source project Santa Hat
3rd June, 2010 at 19:45:49 -

what do you mean to always move the detector to the player?

 
n/a

Sketchy

Cornwall UK

Registered
  06/11/2004
Points
  1970

VIP MemberWeekly Picture Me This Round 43 Winner!Weekly Picture Me This Round 47 WinnerPicture Me This Round 49 Winner!
3rd June, 2010 at 20:13:51 -

I made an example.
If this isn't what you meant, then you need to explain more clearly.

http://cid-b1e7ee094271bbda.skydrive.live.com/self.aspx/Public/Scroll.mfa

 
n/a

Jon C-B

I create vaporware

Registered
  23/04/2008
Points
  237

I'm an alien!VIP MemberWii OwnerI donated an open source project Santa Hat
3rd June, 2010 at 20:26:35 -

hmm im not sure. I needed to know because in my new project Blob of Doom - http://www.create-games.com/project.asp?id=1897 When you grow you can access more of the area. I'm doing this by putting a detector on the right side of the screen (it expands to the right) which you can't go through. But if i center the player in on the screen you see the part of the area you can't go to, which is what i dont want to happen. So i want an other object i guess to handle the scrolling, but doesn't show the stuff to the right of the detector. Do you see what i mean?

 
n/a

Sketchy

Cornwall UK

Registered
  06/11/2004
Points
  1970

VIP MemberWeekly Picture Me This Round 43 Winner!Weekly Picture Me This Round 47 WinnerPicture Me This Round 49 Winner!
3rd June, 2010 at 20:47:24 -

That'll work fine then:
http://cid-b1e7ee094271bbda.skydrive.live.com/self.aspx/Public/Scroll2.mfa

It's even easier if the screen doesn't scroll vertically aswell:
http://cid-b1e7ee094271bbda.skydrive.live.com/self.aspx/Public/Scroll3.mfa

Infact, in that case it would probably be easier and more efficient to just compare the X position of the player, and not move the camera object if is greater than some value:
http://cid-b1e7ee094271bbda.skydrive.live.com/self.aspx/Public/Scroll4.mfa

Edited by Sketchy

 
n/a

Jon C-B

I create vaporware

Registered
  23/04/2008
Points
  237

I'm an alien!VIP MemberWii OwnerI donated an open source project Santa Hat
3rd June, 2010 at 21:34:07 -

Great! Thanks a ton

 
n/a

Jon C-B

I create vaporware

Registered
  23/04/2008
Points
  237

I'm an alien!VIP MemberWii OwnerI donated an open source project Santa Hat
3rd June, 2010 at 21:35:37 -

But what am i supposed to do for the "X position of player < ____" The window size is 480 if that helps.

 
n/a

Sketchy

Cornwall UK

Registered
  06/11/2004
Points
  1970

VIP MemberWeekly Picture Me This Round 43 Winner!Weekly Picture Me This Round 47 WinnerPicture Me This Round 49 Winner!
3rd June, 2010 at 22:05:04 -

Assuming you're scrolling by exactly one screen width (480 pixels) per level, you could say:

* If X Position of player < (ScreenWidth * (LevelNumber - 1)) + (ScreenWidth / 2)
-> Set Camera at 0,0 from Player

eg. Press space to unlock the next level
http://cid-b1e7ee094271bbda.skydrive.live.com/self.aspx/Public/Scroll5.mfa


Otherwise, use trial and error to find a value that works.


 
n/a

Jon C-B

I create vaporware

Registered
  23/04/2008
Points
  237

I'm an alien!VIP MemberWii OwnerI donated an open source project Santa Hat
3rd June, 2010 at 22:11:49 -

Wow thanks a ton. The only problem though it that it jumps abit... it not that big of a deal but it would be great to not have

 
n/a

Sketchy

Cornwall UK

Registered
  06/11/2004
Points
  1970

VIP MemberWeekly Picture Me This Round 43 Winner!Weekly Picture Me This Round 47 WinnerPicture Me This Round 49 Winner!
3rd June, 2010 at 22:34:09 -

Easiest way would be to to set X("Camera") to something like:

X("Camera") + ((X("Player") - X("Camera")) * 0.1)

...instead of setting it to 0,0 from Player

 
n/a

AndyUK

Mascot Maniac

Registered
  01/08/2002
Points
  14586

Game of the Week WinnerSecond GOTW AwardHas Donated, Thank You!VIP Member
4th June, 2010 at 02:55:59 -

This isn't for our game is it Jon? I know how to do stuff you know!

 
.

Jon C-B

I create vaporware

Registered
  23/04/2008
Points
  237

I'm an alien!VIP MemberWii OwnerI donated an open source project Santa Hat
4th June, 2010 at 18:22:37 -

haha no it isn't. Its for Blob of Doom, my current side project

 
n/a

Jon C-B

I create vaporware

Registered
  23/04/2008
Points
  237

I'm an alien!VIP MemberWii OwnerI donated an open source project Santa Hat
4th June, 2010 at 18:33:51 -

oh it works even better! thank you so much

 
n/a
   

Post Reply



 



Advertisement

Worth A Click