The Daily Click ::. Forums ::. Klik Coding Help ::. Screen Scrolling (Its a mess)
 

Post Reply  Post Oekaki 
 

Posted By Message

Windybeard Games



Registered
  14/04/2005
Points
  219

You've Been Circy'd!VIP MemberCandy Cane
30th August, 2005 at 22:55:47 -

The game im making at present uses a 320x240 res.
The character moves on a 32x32 tile movement
When the player leaves the screen at any end the screen scrols to the next screen,
(Like Lost Valley) heres the code:

ONLY WHEN EVENT LOOPS ONCE
+ X POSITION OF PLAYER >= X RIGHT FRAME
center desplay at X=X(player) +160
set X position to X (player) +2

ONLY WHEN EVENT LOOPS ONCE
+ X POSITION OF PLAYER <= X LEFT FRAME
center desplay at X=X(player) -160
set X position to X (player) -2

ONLY WHEN EVENT LOOPS ONCE
+ Y POSITION OF PLAYER >= Y BOTTOM FRAME
center desplay at y=y(player) +120
set Y position to Y (player) +2

ONLY WHEN EVENT LOOPS ONCE
+ Y POSITION OF PLAYER <= Y TOP FRAME
center desplay at y=y(player) -120
set Y position to Y (player) -2

It works fine but after the screen has scrolled a couple of times the screen is out of place, only by a few pixels but every time, but after alot of scrolls the screen is completly off.
Im pretty sure it has somthing to do with the bottom line of each code or the fact that the character moves 32x32 but i dont know if it is or how to fix it,

If anyone can help that would be fantastic!





Image Edited by the Author.

 
n/a

AndyUK

Mascot Maniac

Registered
  01/08/2002
Points
  14586

Game of the Week WinnerSecond GOTW AwardHas Donated, Thank You!VIP Member
31st August, 2005 at 08:55:11 -

It could be something like the characters animation, if fine detection is turned on then the characters arm was sticking out could make a few pixels difference.

you could try a different method that counts the amount of tiles moved. Use either an alterable value or counter and count the amount of tiles moved.

pressed right+ counter/value = 10 scroll the screen to the right and set value to 0.
pressed left+ counter/value = 0 scroll the screen to the left and set value to 16.

just a thought really.

 
.

Windybeard Games



Registered
  14/04/2005
Points
  219

You've Been Circy'd!VIP MemberCandy Cane
31st August, 2005 at 14:54:41 -

Thx for the help,
Phizzy you just saved my game, thx alot!

 
n/a

KevinHaag



Registered
  28/01/2005
Points
  266

VIP Member
1st September, 2005 at 13:41:16 -

Phizzy hasn't been his comedic self lately and has actually said quite a few helpful things... whats happened Phiz? Is something wrong?

 
Image
http://www.kevinhaag.ca
   

Post Reply



 



Advertisement

Worth A Click