The Code-Bin
Links
Home
Add your code!
All Listings
About
Latest Entry
Featured Scripts
Author's Website
Latest Entries
FFMPEG Thumbnail Scr...
PHP, 0.8KB
Jul. 29, 10:24pm
John
Z80 Assembler, 190 bytes
Feb. 17, 3:36am
John
Z80 Assembler, 176 bytes
Sep. 13, 2:19am
John
Z80 Assembler, 77 bytes
Sep. 13, 2:18am
John
Z80 Assembler, 209 bytes
Sep. 13, 2:17am
untitled C++ Code
Posted by: SolarSystem.h | March 12, 2010 @ 11:01pm
C++ Code
[
Download
]
//SUN\\ int sun = 1; int SunType; void CreateSun( int SizeValue ) { int ship = 1000; double size; /*Sizes - 0 = 750,000 Unit Radius 1 = 1,000,000 Unit Radius 2 = 1,500,000 Unit Radius 3 = 2,000,000 Unit Radius */ switch ( SizeValue ) { case 0: size = 750000; dbLoadImage( "sun0.png", sun); SunType = 0; break; case 1: size = 900000; dbLoadImage( "sun1.png", sun); SunType = 1; break; case 2: size = 1000000; dbLoadImage( "sun2.png", sun); SunType = 2; break; case 3: size = 1109999; dbLoadImage( "sun3.png", sun); SunType = 3; break; } dbMakeObjectSphere(sun , 1, 100, 100); dbPositionObject(sun, 0, 0, 0); dbScaleObject ( sun, size, size, size ); dbTextureObject ( sun, sun ); dbSetObjectLight ( sun, true ); dbSetObjectAmbient ( sun, 0 ); dbSetObjectEmissive ( sun, RGB(255, 255, 0) ); dbLoadImage( "ship.png", ship); dbLoadObject ( "ship.x", ship ); dbMakeObject(ship, ship, ship); dbTextureObject (ship, ship); dbPositionObject(ship, 1500, 1500, -6000); //dbScaleObject (ship, dbSetObjectLight (ship, true); } //////////////////////////////////////////////////////////// //Load Planet Textures\\ //////////////////////// void CreateTinySystem() { dbLoadImage ( "Earth.tga", 2); dbLoadImage ( "GasGiant.jpg", 3); dbLoadImage ( "GasGiant2.jpg", 4); dbLoadImage ( "IcePlanet.jpg", 5); dbLoadImage ( "DeadEarth.jpg", 6); dbLoadImage ( "CloseToSun.jpg", 7); int PlanetCount = 1; int PlanetID = 2; int life = dbRND(4); for( PlanetCount = 1; PlanetCount <= (dbRND(2) + 1); PlanetID++) { int life = dbRND(4); int PlanetSize = (dbRND(2) + 1); switch(PlanetSize) { case 1: //Plutoish Planet dbMakeObjectSphere (PlanetID, 1, 100, 100); dbPositionObject (PlanetID, ((dbObjectPositionX(sun)) + (dbRND(600000) + 400000)), dbObjectPositionY(sun), ((dbObjectPositionZ(sun)) + (dbRND(600000) + 400000))); dbScaleObject ( PlanetCount, 100000, 100000, 100000 ); dbTextureObject ( PlanetCount, 5 ); dbSetObjectLight ( PlanetCount, true ); break; case 2: //Earth/DeadEarth if life == 0; { dbMakeObjectSphere (PlanetID, 1, 100, 100); dbPositionObject (PlanetID, ((dbObjectPositionX(sun)) + (dbRND(300000) + 200000)), dbObjectPositionY(sun), ((dbObjectPositionZ(sun)) + (dbRND(300000) + 200000))); dbScaleObject ( PlanetCount, 200000, 200000, 200000 ); dbTextureObject ( PlanetCount, 2 ); dbSetObjectLight ( PlanetCount, true ); } else { dbMakeObjectSphere (PlanetID, 1, 100, 100); dbPositionObject (PlanetID, ((dbObjectPositionX(sun)) + (dbRND(300000) + 200000)), dbObjectPositionY(sun), ((dbObjectPositionZ(sun)) + (dbRND(300000) + 200000))); dbScaleObject ( PlanetCount, 200000, 200000, 200000 ); dbTextureObject ( PlanetCount, 6 ); dbSetObjectLight ( PlanetCount, true ); } break; case 3: //Close to sun dbMakeObjectSphere (PlanetID, 1, 100, 100); dbPositionObject (PlanetID, ((dbObjectPositionX(sun)) + (dbRND(100000) + 60000)), dbObjectPositionY(sun), ((dbObjectPositionZ(sun)) + (dbRND(100000) + 60000))); dbScaleObject ( PlanetCount, 150000, 150000, 150000 ); dbTextureObject ( PlanetCount, 5 ); dbSetObjectLight ( PlanetCount, true ); break; } PlanetID++; } } void CreateSmallSystem() { return; } void CreateMediumSystem() { return; } void CreateLargeSystem() { return; } void CreatePlanets() { switch(SunType) { case 0: CreateTinySystem(); break; case 1: CreateSmallSystem(); break; case 2: CreateMediumSystem(); break; case 3: CreateLargeSystem(); break; } }
Syntax Highlighting
[
Open in new window
]
Author Comments
Header file for a Space Exploration Game - not completed
Rating
4.45 / 8
58 Votes