The Daily Click ::. Forums ::. Klik Coding Help ::. Vertical Scrolling
 

Post Reply  Post Oekaki 
 

Posted By Message

»xerus



Registered
  28/06/2002
Points
  675

You've Been Circy'd!Game of the Week Winner
28th November, 2004 at 02:33:07 -

I'm making a somewhat simple platformer engine that I want to use for a game. I want the scrolling to be somewhat different though.

I already have it set up so that the x scrolling goes a little bit ahead of the character. Thats all fine and good, however its the vertical scrolling that gives me a headache.

Its a 320 x 240 game, so there isnt that much visible area. When the character jumps, he takes the window with him. So this creates the problem that you can see the ground when your at the peak of your jumps, and its especially worse when hes not near the bottom of the playfield.

So my question is, is there any way to make it so the vertical scroll only scrolls when its necessary? So that it will stay locked in place unless the character has changed height or is falling/jumping more than the screen size?

I've already been thinking about many ways to do this, but all of which I dont think will work. I dont think its going to be as simple as the y values of the frame and character..

And if it helps any, I'm using the platform extension object.

 
n/a

Tigerworks

Klik Legend

Registered
  15/01/2002
Points
  3882
28th November, 2004 at 09:40:59 -

Easy solutions:
- Dont make your character jump so high.
- Make the window bigger.
Hard solutions:
- Invent some complicated algorithm which will scroll to the Y position of where the player will land, which you can't actually calculate, e.g. if they jump up on to a high platform.

 
- Tigerworks

RapidFlash

Savior of the Universe

Registered
  14/05/2002
Points
  2712
28th November, 2004 at 14:00:58 -

You could make two active objects, and do something like:
Y("Player") < Y("High Scroll") --> Set Y Pos of High Scroll to Y("High Scroll") - (value)

Y("Player") > Y("Low Scroll") --> Set Y Pos of Low Scroll to Y("Low Scroll") + (value)


 
http://www.klik-me.com

Klikmaster

Master of all things Klik

Registered
  08/07/2002
Points
  2599

Has Donated, Thank You!You've Been Circy'd!VIP MemberPS3 Owner
28th November, 2004 at 16:14:25 -

Or maybe say to change vertical screen position only when the character is touching the floor

 
n/a

Radix

hot for teacher

Registered
  01/10/2003
Points
  3139

Has Donated, Thank You!VIP MemberGOTW WINNER CUP 1!GOTW WINNER CUP 2!GOTW WINNER CUP 3!GOTW WINNER CUP 4!
28th November, 2004 at 16:45:00 -

Just have the vertical scroll lag behind, so when the char is at the peak of his jump the vertical scroll hasn't caught up yet.

 
n/a

»xerus



Registered
  28/06/2002
Points
  675

You've Been Circy'd!Game of the Week Winner
28th November, 2004 at 20:59:24 -

Thanks for the suggestions. I sort of combined all of them to make it work pretty good.

I made it so when the character is standing on the ground, he sets a value that is the current locked Y position for the camera. Then, when the character jumps or falls and is approaching the edge of the screen (I used values based off the locked Y, rather than screen edge.) then the camera follows the character.

I worked it out so it runs pretty smooth too, thanks ;D

Now if you dont mind answering another question...
I programmed water into the engine, but using an active transparent object slows the game down slightly, and of course the larger the object the more it lags. Is there any alternative to an active object that I could use that would still overlap the character and be semi-transparent?

Thanks again.

 
n/a

Radix

hot for teacher

Registered
  01/10/2003
Points
  3139

Has Donated, Thank You!VIP MemberGOTW WINNER CUP 1!GOTW WINNER CUP 2!GOTW WINNER CUP 3!GOTW WINNER CUP 4!
28th November, 2004 at 22:25:01 -

You can:

a) have lots of 32x32 transparant water objects, but lots of little ones will probably slow it down as much as one big one.

b) have lots of little objects that are a mesh of transparent and blue pixels (like, every other pixel is transparent, the others are blue).

c) just have a water background behind. Depending on the graphic style, it's usually possible to have static background water that still looks pretty good.

There's another, more complex method involving changing the colour of just the player sprite as it enters water, but there's several ways of doing it and it's too involved for me to feel like explaining it.

 
n/a

Rick (AntiMatter Entertainment)

Possible psychotic

Registered
  18/10/2002
Points
  814

VIP Member360 OwnerWii Owner
28th November, 2004 at 22:27:49 -

The only things that can overlap non-backdrop objects are actives and counters and the like. You could try only putting actives where the player can go, and use backdrop water tiles for the rest, although you won't be able to animate them obviously. Also, the transparent effect will make the active water look lighter (or darker, depending on the background) than the rest, but you can counter this by taking a screenshot of transparent water over the background and using that as your tile instead.

 

»xerus



Registered
  28/06/2002
Points
  675

You've Been Circy'd!Game of the Week Winner
2nd December, 2004 at 13:02:36 -

Yay, the transparency changer doesnt produce so much lag. Thanks ;D

 
n/a

RapidFlash

Savior of the Universe

Registered
  14/05/2002
Points
  2712
2nd December, 2004 at 22:31:44 -

Nash used counters for water in one of his games, and that shouldn't cause that big of a slowdown.

 
http://www.klik-me.com

Individual Thought

Dances with Pixels

Registered
  30/08/2002
Points
  79

VIP MemberWii Owner
4th December, 2004 at 03:35:59 -

Holy Balls! There's a transparency extension?!

Image Edited by the Author.

 
Currently and mainly working on my fantasy epic entitled: Drawn Sword.
   

Post Reply



 



Advertisement

Worth A Click