This site requires JavaScript, please enable it in your browser!
Greenfoot back

Report as inappropriate.

sp33dy
sp33dy presents ...

2012/3/14

Scrolling Landscape

Demo, soon to be a game I've been working on with smooth scrolling, simple mountain (landscape) generation with gradient fills, with parallel scrolling effect and moving space ship. The rocket will blast off and can be rotated left/right to speed up scrolling. Gravity and friction are used to ensure a realistic feel to the physics. The landscape scrolls through 360 degree's of pre-generated landscape; therefore the peaks of the hills will match the degree coordinates, as can be seen in the compass. The Sun and Earth rotate around the 360 degree's, according to their distance from Mars, with the Earth being closer. These objects inheret from a base Heading class, which is used to trigger the direction the player is viewing; all objects therefore inheret their placement in the world.

A thin blue line is shown at the centre of the screen for now for me to check sequences etc.

Controls:

Left / Right to turn
Down to thrust

Please do look at the code and ask questions. I ask that you don't copy this as a whole, but do use it as a basis for your own game. I intend of adding several 'game' themes to this idea to show the realms of possibilities..

6217 views / 15 in the last 7 days

12 votes | 0 in the last 7 days

Tags: game simulation physics demo with-source scroll

open in greenfoot

There is no HTML 5 translation of this scenario available.
View legacy version (requires Java plugin)

This scenarios uses Java features that are not available for use after conversion to HTML 5. Please try the legacy version, which requires the Java plugin to be installed.

A new version of this scenario was uploaded on Thu Mar 15 10:58:37 UTC 2012 Scrolling now sorted! Surprised to find that drawing each frame is quicker than trying to shift pixels and drawing at the end! The terrain tearing has now been fixed. I'm going to change the scrolling to float rather than int based; which should result in smoother scrolling. My other task is to remove the current control and implement the standard gravity/thrust/turn type. All pretty basic, but I needed to suss scrolling out in Greenfoot/Applets.. Code isn't as tidy as I would like, but thought it might inspire someone. As usual, please feel free to use code, but please do credit the use.
A new version of this scenario was uploaded on Thu Mar 15 11:01:22 UTC 2012 Ooops, the front 'crater' landscape layer wasn't scrolling fast enough.. Fixed.
A new version of this scenario was uploaded on Thu Mar 15 21:38:37 UTC 2012 Some rudimentary physics added. I.E. Gravity and inertia. Now need to fix X travel etc. Time for bed though :( Will provide code when ready.
A new version of this scenario was uploaded on Tue Mar 20 09:45:09 UTC 2012 Still working on this. Managed to get the physics right. Needs a tweak in terms of 'feel'. Hitting the ground results in a complete stop. Will soon have landing and explosions! Where next? Got lots of ideas for game. I.E. Collect and drag around type, or strategy build a colony or something else?? Thoughts?
A new version of this scenario was uploaded on Tue Apr 03 11:57:00 UTC 2012 Completely rewritten the background scrolling. I wanted the Sun to revolve around the world. I've also optimised the scrolling (although there are two other areas I need to focus on). I've added a compass and can scale the world if required. I'm now thinking about 'what' to do for the game. Three ideas: (1) Typical fly round, pick up objects (via track beam) (2) Command spacemen around world, picking up/dropping off (3) the first two in a strategic based game.. The code has been published with this release. Please don't just copy wholesale. If you like it, please 'LIKE' and credit me in any releases. My next action will be to add a purpose to the engine (which will include a level map builder). Yep, going to add in a builder as if this was a typical map type game.
A new version of this scenario was uploaded on Tue Apr 03 11:59:34 UTC 2012 Completely rewritten the background scrolling. I wanted the Sun to revolve around the world. I've also optimised the scrolling (although there are two other areas I need to focus on). I've added a compass and can scale the world if required. I'm now thinking about 'what' to do for the game. Three ideas: (1) Typical fly round, pick up objects (via track beam) (2) Command spacemen around world, picking up/dropping off (3) the first two in a strategic based game.. The code has been published with this release. Please don't just copy wholesale. If you like it, please 'LIKE' and credit me in any releases. My next action will be to add a purpose to the engine (which will include a level map builder). Yep, going to add in a builder as if this was a typical map type game.
sp33dysp33dy

2012/4/3

Please remember this is WIP; therefore I'm aware of plenty of bugs (i.e. when hitting ground etc, etc). I just wanted to update the scenario to show progress.
A new version of this scenario was uploaded on Tue Apr 03 19:02:52 UTC 2012 Thought I'd add an Earth; given I've decided this game will be on Mars. Do look at how easy parallex scrolling is to mimic.
A new version of this scenario was uploaded on Sat Apr 07 17:07:56 UTC 2012 Changed the landscape code to work correctly with a speed value; thus improving parallex scrolling whilst maintaining correct positioning with homebase. Homebase added. Earth/Sun speeded up to meet game expectations. I've now made scribbles on the game plan! Will start to implement them. This is going to be a resource collecting game. First step, get spaceman added with controls via mouse.
ShoutToUsShoutToUs

2012/12/6

I think that this is a very cool concept to use in a sidescrolling game, It would be very cool to see if there were some enemies to fight as you flew

See all comments

Want to leave a comment? You must first log in.

Who likes this?

nachocab Mimagic JetLennit birdy Deepraj davemib123 Game/maniac miles7191 jaogfbot Antonio rafaelpaim matt.milan