Moving backgrounds

I was using a pretty lame technique to move the background starfield under the player’s ship and the more I struggled with it, the more I saw its flaws.  I had 4 panels, each was the same size as the game screen and a pretty nice starfield pattern.  I would move the panels according to the ship’s velocity and direction.  When one panel went offscreen, I would move it to the opposite side so it could be re-used.

My primary flaw in logic was that I had a cyclic error when testing to see if the panels’ x,y coordinates were less/greater/equal to the boundaries of the game.  I’d detect that panel 1 was off-screen, then place it in a position where it would then get picked up by another off-screen check and guess what?  You’d never see that panel again.  The equal-to part of the check was the main problem.

Anyway, I decided to use two overlapping randomly-generated starfields instead.  My offscreen checks are now nice and tight, and I can get funky with what happens in those checks (like change the star’s color or whatever).  The double-starfield looks sweet, too.  The top layer has 3-pixel stars and the bottom has 1-pixel stars.  The bottom layer moves a bit slower.  The effect pleases me.  I am pleased.  Yes.

Your first taste of Splodge Pre-Alpha .0001

The ship is ripped off from Lost Garden’s free game graphics collection.  I highly recommend Lost Garden for anybody noodling about in the indy game cosmos.  I’m probably going to use some of my kids’ art as soon as I get it digitized, or they’ll make some for me on their ‘puters.

Anywhooo, this is your first chance to test out Splodge Pre-Alpha v0.00001!  Some notes before you check it out:

– Click yer left mouse button to fire, use your mouse to aim/steer.
– Press W to accelerate, S to decelerate.  I don’t have fancy physics worked out so that your velocity/direction is dampened correctly when you turn and burn.
– I don’t have thrust sound or graphics yet.
– The laser shot sounds get clipped occasionally.  Still working on that.
– The stars are really cool.  Just keep that in mind.
– Be careful using Silverlight in Firefox (especially FF3, apparently).  I’ve seen it crash several times, and not on my stuff, but on the official Silverlight.net site mostly.
– This build was made with Silverlight 2 Beta 2.

Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

%d bloggers like this: