OK two things...
1. Great job so far... in terms of game programming you are almost finished... well half done. By that I mean the real hard part is behind you (the ball and paddle.)
2. It is really only the simple things that have to be set now. Sound is a matter of selecting sounds for events and inserting PLAYSOUND at the proper location. Background music if you want. Drawing the targets could be accomplished with types... OR as DATA so you could change position and color each level (if you decide to have levels.) It is housekeeping really.
Keep up the good work. What you learn by solving problems on this game will help you in all Blitz.
I added a few commented out lines... stuff to show you how really close you are to the end... it took me about 15 min. and I don't claim to be a genius...
OH my new suggestion... MORE RANDOM ANGLES off the paddle!
-RZ
1. Great job so far... in terms of game programming you are almost finished... well half done. By that I mean the real hard part is behind you (the ball and paddle.)
2. It is really only the simple things that have to be set now. Sound is a matter of selecting sounds for events and inserting PLAYSOUND at the proper location. Background music if you want. Drawing the targets could be accomplished with types... OR as DATA so you could change position and color each level (if you decide to have levels.) It is housekeeping really.
Keep up the good work. What you learn by solving problems on this game will help you in all Blitz.
; ############################ ; ## BREAKOUT CLONE ## ; ## by ## ; ## FIGMENT ## ; ## a.k.a. ## ; ## (insert name here) ## ; ## 05 FEB 2004 ## ; ############################ Graphics3D 800,600,16,1 HidePointer() ; ######################################################################### ; Include "bmpfont3d.bb" ; myfont=LoadBMPFont("sho0") ; Uncomment the 2 lines above (and use the include files) and you will have a nice font ; ######################################################################### camera=CreateCamera() light=CreateLight() LightColor light,100,100,100 RotateEntity light,180,0,0 Const CUBE_COL=1 Const SPHERE_COL=2 ;create ball Global ball=CreateSphere(12) ScaleEntity ball,3,3,3 EntityColor ball,20,50,255 EntityShininess ball,.5 maxballspd#=5 ;create paddle Global p1=CreateCube() ScaleEntity p1,20,3,2 EntityColor p1,20,20,255 ; ################################################################################### ;ballhit = LoadSound("sounds/ballhit.wav") ; loading sounds and playing them I added simply... you probably already know them ; ################################################################################### ; Adding cool looking letters on the screen is really simple... I use a PNG with ; the letters in a scheme and a lib to read them that is free domain by the author ; ;setup Collisions table EntityType ball,SPHERE_COL EntityType p1, CUBE_COL Collisions SPHERE_COL,CUBE_COL,2,2 arena=CreateCube() EntityColor arena,200,100,0 FlipMesh arena : ScaleEntity arena,200,150,5 EntityType arena,CUBE_COL Local vx#=2,vy#=2 While Not KeyHit(1) x1#=x1#+MouseXSpeed()*0.5 MoveMouse GraphicsWidth()/2,GraphicsHeight()/2 oldx#=EntityX(p1) If x1#<-180 Then x1#=-180 If x1#>180 Then x1#=180 PositionEntity p1,x1#,122,0 PFx#=EntityX(p1)-oldx PositionEntity camera,0,0,200 RotateEntity camera,180,0,0 If EntityCollided(ball,CUBE_COL) Then Nx# = CollisionNX(ball, 1) Ny# = CollisionNY(ball, 1) ; Compute the dot product of the entity's motion vector and the normal of the surface collided with. VdotN# = Vx# * Nx# + Vy# * Ny# ; Calculate the normal force. NFx# = -2.0 * Nx# * VdotN# NFy# = -2.0 * Ny# * VdotN# ; Add the normal force to the direction vector. ; if coll with paddle include some paddle force If CollisionEntity(ball,1)=p1 Then ; PlaySound(ballhit) ; ##################### I ADDED THIS Vx# = Vx# + NFx# + PFx#*0.5 Vy# = Vy# + NFy# - Abs(PFx#*0.1) Else Vx# = Vx# + NFx# Vy# = Vy# + NFy# EndIf EndIf ;limit ballspeed ballspd# = Sqr(Vx# * Vx# + Vy# * Vy#) If ballspd# > maxballspd# Then Vx# = Vx# / ballspd# * maxballspd# Vy# = Vy# / ballspd# * maxballspd# EndIf TranslateEntity ball,Vx,Vy,0 PositionEntity ball,EntityX(ball),EntityY(ball),0 ; stay at the same Z UpdateWorld RenderWorld ; ####################################################################################### ; BMPText myfont,10,35,"YOUR SCORE: "+score ; ; this is how simple it is to add text to the screen instead of TEXT use BMPText... ; note score is a variable... added to when the ball hits a paddle. ; ####################################################################################### Flip Wend End
I added a few commented out lines... stuff to show you how really close you are to the end... it took me about 15 min. and I don't claim to be a genius...
OH my new suggestion... MORE RANDOM ANGLES off the paddle!
-RZ