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
2 physics
Posted by: fsgfdsg | March 14, 2010 @ 1:09pm
C++ Code
[
Download
]
#include "DarkGDK.h" void DarkGDK ( void ) { dbSyncOn ( ); dbSyncRate ( 60 ); dbSetDisplayMode ( 1024 , 768 , 32 ); dbSetWindowSize ( 1024, 768 ); dbDisableEscapeKey ( ); dbRandomize ( dbTimer ( ) ); dbSprite ( 1, 0, 0, 1 ); dbSetImageColorKey ( 255, 0, 255 ); dbCLS ( dbRgb(0,0,255) ); dbInk ( dbRgb(255,255,255), dbRgb(0,0,255)); int size_y = dbScreenHeight(); int size_x = dbScreenWidth(); double x = 15; double y = 15; double xSpeed = 0; double ySpeed = 0; double xThrust = 0; double yThrust = 0; ///////////////////////////////////////////// while ( LoopGDK ( ) ) { dbCLS( dbRgb(0,0,255) ); ////GUI dbSetCursor(0,30); dbPrint(xSpeed); dbPrint(ySpeed); dbPrint(xThrust); dbPrint(yThrust); ////Box dbBox ( x, y, x + 15, y + 15); xThrust = 0; yThrust = 0; //* ////Controls if ( dbLeftKey() ) xThrust = -1; if ( dbRightKey() ) xThrust = 1; if ( dbUpKey() ) yThrust = -1; if ( dbDownKey() ) yThrust = 1; if ( dbSpaceKey() ) { xSpeed = 0; ySpeed = 0; } //*/ ////Speed limits if (xSpeed > 3) xSpeed = 3; if (ySpeed > 3) ySpeed = 3; if (xSpeed < -3) xSpeed = -3; if (ySpeed < -3) ySpeed = -3; //* //// Borders if ( x > 1024 ) { x = 1024 - 15; xSpeed = 0; } if ( x < 0 ) { x = 0; xSpeed = 0; } if ( y > 768 ) { y = 768 - 15; ySpeed = 0; } if ( y < 0 ) { y = 0; ySpeed = 0; } //*/ //* ////Movement if (xThrust == 1) xSpeed += 0.2; if (yThrust == 1) ySpeed += 0.2; if (xThrust == -1) xSpeed += -0.2; if (yThrust == -1) ySpeed += -0.2; //*/ x += xSpeed; y += ySpeed; dbSync ( ); } return; }
Syntax Highlighting
[
Open in new window
]
Author Comments
none
Rating
4.52 / 8
54 Votes
http://codebin.yi.org/547
page generated in 0.00 seconds