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

Post Reply  Post Oekaki 
 

Posted By Message

LilSpriteX



Registered
  08/05/2003
Points
  28
11th June, 2003 at 02:47:56 -

My friend and I are having troubles making a shooter type scrolling engine. I created a camera object for the scrolling to follow, and I tried making it a slow bouncing ball and changing it's Y position so it moves up (not both of those at the same time, though). The problem, though, is making sure the player doesn't fall off screen. If I have it simply stop when it hits the camera (which is a line, by the way) it will be quickly swallowed and put into limbo. I also tried having the character's Y position change up a bit, but every so often it still falls out. Any ideas of how to keep our hero with the camera without being devoured?

 
n/a

Assault Andy

Administrator
I make other people create vaporware

Registered
  29/07/2002
Points
  5686

Game of the Week WinnerVIP Member360 OwnerGOTM JUNE - 2009 - WINNER!GOTM FEB - 2010 - WINNER!	I donated an open source project
11th June, 2003 at 03:01:38 -

Just:

Always: set screen position to player (x,y).

Or if you have a custom camera, set that position to the player whenever nothing to do with the camera is going on.

 
Creator of Faerie Solitaire:
http://www.create-games.com/download.asp?id=7792
Also creator of ZDay20 and Dungeon Dash.
http://www.Jigxor.com
http://twitter.com/JigxorAndy

LilSpriteX



Registered
  08/05/2003
Points
  28
11th June, 2003 at 03:34:11 -

Thanks for the help, but that's not really the problem I'm having. I must've not explained my problem well enough. Let's see...

The game we're making is going to be a shooter-type game, with automatic scrolling, meaning the camera will always be moving independently of the players. The problem I'm having is when the players hit the camera, while they usually stop, they sometimes end up being pushed through the camera, and can't come back in (since the camera would prevent them). As of now, we'v tried setting up the camera as a big box and putting up four seperate objects on all sides of the camera. Both times, we end up with the bug every once in a while.

So what I need help with is: when the camera ends up hitting the player, it should drag the player along with it, instead of passing the player up. Unfortunately, that's not always the case.

 
n/a

Weston L



Registered
  16/12/2002
Points
  1603
11th June, 2003 at 03:36:56 -

1) Make the camera an active object w/ bouncing ball movement. Have the camera's movement be a little less than the player

2) Always >> Scrollings, set window position on "camera" & have "camera" always look in direction of "player".

3) Camera is overlapping player >> Stop camera

4) (NEGATE) Camera is overlapping player >> Start camera & Set speed to [original speed (because of #5)]

5) Player is closer than 50 pixels from window's edge >> start camera & set speed to [slightly faster than player]

This makes for a good custom camera movement and also the player won't ever be out of the screen.

 
n/a

The Chris Street

Administrator
Unspeakably Lazy Admin

Registered
  14/05/2002
Points
  48487

Game of the Week WinnerClickzine StaffAcoders MemberKlikCast StarVIP MemberPicture Me This Round 35 Winner!Second GOTW AwardYou've Been Circy'd!Picture Me This Round 38 Winner!GOTM December Third Place!!
I am an April FoolKliktober Special Award Tag
11th June, 2003 at 05:55:52 -

Weston, that last one won't work, as that last event applies to all four edges of the screen.

Instead, try this:

Create a detector object the width of the spaceship, and about a quarter of its height, and make an event which ALWAYS positions it just underneath it.

Now:

Y Position of Y (detector) is GREATER OR EQUAL than Y bottom frame: Set position of Y (Spaceship) to Y - 2 (you may need to change this value depending on your ships speed.

 
n/a

LilSpriteX



Registered
  08/05/2003
Points
  28
11th June, 2003 at 13:11:10 -

Thanks a ton for all your help! I think we might try that detector one first, and if that doesn't work, then we'll just use Weston's advice and stop the camera when the player collides with it. Thanks again!

 
n/a
   

Post Reply



 



Advertisement

Worth A Click