Feedback/Complements
Blitz3D Forums/Blitz3D Beginners Area/Feedback/Complements
| ||
I am a DarkBasic Pro user. I am in the process of creating a Sokoban 3D game. First I tried to create it in my natural language which I paid $100 bucks for. After a week of trying to figure out how to create a simple floor with a ball on it I posted in the TGC forums. While waiting I decide to install the Blitz3D Unrestricted Demo from the site and try my luck in getting it to work. All I can say is WOW!, after only a few minutes of reading the Blitz3D tutorial, I managed to get almost exactly what I wanted to do working(don't really care about the rest as I just started learning). I am posting the DarkBasic Pro(Before) and Blitz3D(after) shots as proof. Before: Sync On Sync Rate 30 Rem Create matrix Make Matrix 1,200,200,50,50 Rem create the player object Make Object Sphere 10, 1 Rem position the player object Position Object 10, 0,275,0 do rem store player's angle PlayerAngleY# = Object angle Y(10) Rem get player object position and store in X# and Z# PlayerX# = Object position x(10) PlayerZ# = Object position z(10) Rem get new camera position and store in cZ# and cX# CameraZ# = Newzvalue(PlayerZ#,PlayerAngleY#-180,100) CameraX# = Newxvalue(PlayerX#,PlayerAngleY#-180,100) Rem position camera Position Camera CameraX#,100,CameraZ# Rem point the camera at the player object Point camera PlayerX#,50,PlayerZ# sync loop Modified Code Posted by Forum User ` Setup Display Sync On ` Set Sync Rate Sync Rate 30 ` Disable Automatic Camera Positioning AUTOCAM OFF Rem Create matrix Make Matrix 1,200,200,50,50 Rem create the player object Make Object Sphere 10, 10 Rem position the player object Position Object 10, 0,20,0 rem store player's angle PlayerAngleY# = Object angle Y(10) ` Create A Global Value For The player Speed And Give It A Relative Name global PlayerSpeed = 1 ` Start The Main Loop do Rem position camera Position Camera OBJECT POSITION X(10),OBJECT POSITION Y(10)+20,OBJECT POSITION Z(10)-50 Rem point the camera at the player object Point camera OBJECT POSITION X(10),OBJECT POSITION Y(10),OBJECT POSITION Z(10) ` Implement Movement Controls Kinf Of Self Explanatory if rightkey() position object 10, OBJECT POSITION X(10)+PlayerSpeed,OBJECT POSITION Y(10),OBJECT POSITION Z(10) endif if leftkey() position object 10, OBJECT POSITION X(10)-PlayerSpeed,OBJECT POSITION Y(10),OBJECT POSITION Z(10) endif if upkey() position object 10, OBJECT POSITION X(10),OBJECT POSITION Y(10),OBJECT POSITION Z(10)+PlayerSpeed endif if downkey() position object 10, OBJECT POSITION X(10),OBJECT POSITION Y(10),OBJECT POSITION Z(10)-PlayerSpeed endif ` Sync The Screen sync ` Loop The Main Loop loop ` Good Practice To Place This END Command Here end After: ; Scancode For Escape Key is 1 Global escape_key = 1 ; Scancode For up Key is 200 Global up_key = 200 ; Scancode For down Key is 208 Global down_key = 208 ; Scancode For left Key is 203 Global left_key = 203 ; Scancode For right Key is 205 Global right_key = 205 ; screen width Global screen_width = 640 ;screen height Global screen_height = 480 ; Set video mode Graphics3D screen_width, screen_height, 16, 2 ; setup double buffering SetBuffer BackBuffer() ; Setup camera camera = CreateCamera() CameraViewport camera, 0, 0, screen_width, screen_height ; create a point light light = CreateLight( 2 ) ; create the floor Floor = CreatePlane() ; position the floor PositionEntity Floor, 0, -1, 0 ; create the player object player = CreateSphere() ; and position it PositionEntity player ,0, 0, 10 ; repeat main game loop until you press Escape While Not KeyHit( escape_key ) ; if the player presses the up key If KeyDown( up_key ) = True Then MoveEntity player, 0, 0, .2 ; if the player presses the down key If KeyDown( down_key ) = True Then MoveEntity player, 0, 0, -.2 ; if the player presses the left key If KeyDown( left_key ) = True Then MoveEntity player, .2, 0, 0 ; if the player presses the down key If KeyDown( right_key ) = True Then MoveEntity player, -.2, 0, 0 ; update the world UpdateWorld ; render the world RenderWorld ; 2D stuff here, update HUD, text, stats... Text 50,50,"Hello Cube!" Flip Wend End I was so impressed that i managed to do so much in so little time, that now I am considering converting to Blitz3D. Thanks Blitz for making me a believer! Sincerely, Customer EDIT: A TGC Forum User kindly posted a solution. One thing I noticed is the difference in the amount of code required do the same thing. Last edited 2012 |