The Daily Click ::. Forums ::. Klik Coding Help ::. Any good scrolling ideas/engines?
 

Post Reply  Post Oekaki 
 

Posted By Message

Zephni

My other cars a Balrog

Registered
  17/10/2007
Points
  4019

Has Donated, Thank You!VIP MemberSonic Speed
13th November, 2009 at 14:19:26 -

Some smooth scrolling ideas? what ive just made is a camera that slows down as it gets closer to you and speeds up as its further away. And when you face right it goes about 75 pixels to teh right and vise versa. And by pressing down the camera goes down and stays there, or the other way around, so you can always see in front of you.

But still i want it to be SMOOTHER. .... Because the camera is moveing accdording to the difference between itself and you and the a division of 12, when it gets close to you its starting to hit numbers like 0.45 and -0.7 so its tecknicaly not moveing atal because it needs to be over 1 or under -1 to actualy move a pixel.
Also when you fall from a great height and your speed increases you get away from the camera needs to speed up to catch you. There must be a formula out there that helps this.

Anyway, could everyone throw in their scrolling engines or ideas. Coz ive always had a bit of trouble with makeing a nice one.

Cheers

 
dont make me divide by zero...

Phredreeke

Don't listen to this idiot

Registered
  03/08/2002
Points
  4504

You've Been Circy'd!VIP MemberPS3 Owner
13th November, 2009 at 16:11:00 -

The problem is that the X and Y positions are always an integer.

You could use two separate values to hold a multiple of the X and Y positions, and set the screen's position to a tenth or so of that. (or does MMF support floating point values now?)

 
- Ok, you must admit that was the most creative cussing this site have ever seen -

Make some more box arts damnit!
http://create-games.com/forum_post.asp?id=285363

Rob Westbrook



Registered
  25/05/2007
Points
  193

360 OwnerVIP Member
13th November, 2009 at 16:47:05 -

MMF does support floats, but you have to force it to recognise them as such. Multiplying or dividing by 1.0, adding 0.0 to expressions and I think a few other methods make MMF handle values as floats

 
There are 10 types of people in the world: Those who understand binary and those who don't.

UrbanMonk

BRING BACK MITCH

Registered
  07/07/2008
Points
  49667

Has Donated, Thank You!Little Pirate!ARGH SignKliktober Special Award TagPicture Me This Round 33 Winner!The Outlaw!VIP MemberHasslevania 2!I am an April FoolKitty
Picture Me This Round 32 Winner!Picture Me This Round 42 Winner!Picture Me This Round 44 Winner!Picture Me This Round 53 Winner!
13th November, 2009 at 17:12:22 -

The way I've done it is by using a correction factor.

Like so:

Set "cam" x position to
x("cam")+((x("player")-x("cam"))*0.3)+max(min(x("player")-x("cam"),1),-1)+Changeinx("player")

Set "cam" y position to
y("cam")+((y("player")-y("cam"))*0.3)+max(min(y("player")-y("cam"),1),-1)+Changeiny("player")

And Changeinx("player") is calculated before hand so that the camera will move ahead of the player.

No floats = No wasted Variables.

 
n/a

Zephni

My other cars a Balrog

Registered
  17/10/2007
Points
  4019

Has Donated, Thank You!VIP MemberSonic Speed
15th November, 2009 at 12:49:13 -

Ok, i see what your getting at...
Now ive been useing click products all my life and i didnt know you could choose wether you want all your variables to be floats or ints... Howd you do that?

 
dont make me divide by zero...

X_Sheep

I had a custom rating before it was cool

Registered
  01/03/2004
Points
  1313

VIP MemberPicture Me This -Round 23- Winner!Dos Rules!
15th November, 2009 at 14:41:48 -

The safest way to do it is to start your expression with 1.0 * (...) so MMF2 recognizes the expression as a float. You can store floats and integers in any alterable value, but X and Y position are always forced to an integer.

 
a/n

Zephni

My other cars a Balrog

Registered
  17/10/2007
Points
  4019

Has Donated, Thank You!VIP MemberSonic Speed
15th November, 2009 at 16:53:01 -

Ohh i see so there is no way of telling MMF to imediately recognise all vars as floats. Ok, ive sorted it out now anyway. Cheers guys

 
dont make me divide by zero...

AndyUK

Mascot Maniac

Registered
  01/08/2002
Points
  14586

Game of the Week WinnerSecond GOTW AwardHas Donated, Thank You!VIP Member
15th November, 2009 at 17:30:14 -

Ive always liked setting my monitor refresh rate to the same as the frame rate as my game (60hz/60fps for smooth scrolling. turning Vsync on helps too. The only trouble is that you need to manually change the refresh rate... I don't know of any extension that can force a refresh rate change.

 
.
   

Post Reply



 



Advertisement

Worth A Click