Retro Lord Posted February 3, 2015 Share Posted February 3, 2015 I'm testing my waters doing a racing game in order to further my understanding of bb, and I've realised I must learn a new way to increase difficulty speed. Player1 is a car that goes faster and faster and creates a light trail over time. This is 10 frames long. What would be the most efficient way to make player0y+ increase over that time. When f=100 that would be max speed. My current way is no good at all: if f=10 then _P0_U_D=_P0_U_D+1.00 if f=20 then _P0_U_D=_P0_U_D+1.10 if f=30 then _P0_U_D=_P0_U_D+1.20 if f=40 then _P0_U_D=_P0_U_D+1.30 if f=50 then _P0_U_D=_P0_U_D+1.40 if f=60 then _P0_U_D=_P0_U_D+1.50 if f=70 then _P0_U_D=_P0_U_D+1.60 if f=80 then _P0_U_D=_P0_U_D+1.70 if f=90 then _P0_U_D=_P0_U_D+1.80 if f=100 then _P0_U_D=_P0_U_D+1.90 Quote Link to comment Share on other sites More sharing options...
+Random Terrain Posted February 3, 2015 Share Posted February 3, 2015 If you mean it's not fast enough, then try increasing the numbers._ if f=10 then _P0_U_D=_P0_U_D + 1.00 if f=20 then _P0_U_D=_P0_U_D + 1.20 if f=30 then _P0_U_D=_P0_U_D + 1.40 if f=40 then _P0_U_D=_P0_U_D + 1.60 if f=50 then _P0_U_D=_P0_U_D + 1.80 if f=60 then _P0_U_D=_P0_U_D + 2.00 if f=70 then _P0_U_D=_P0_U_D + 2.20 if f=80 then _P0_U_D=_P0_U_D + 2.40 if f=90 then _P0_U_D=_P0_U_D + 2.60 if f=100 then _P0_U_D=_P0_U_D + 2.80 _ If that's not fast enough, try increasing the numbers even more. Quote Link to comment Share on other sites More sharing options...
Retro Lord Posted February 3, 2015 Author Share Posted February 3, 2015 It's plenty fast enough it's just that player0 staggers until it hits max speed then it goes nuts and into some weird hyperspeed. rem CODE INSPIRED BY Atarius Maximus at http://www.atariage.com/forums/index.php?showtopic=109288 set kernel_options player1colors no_blank_lines dim _Bit1_FireB_Restrainer = d dim _P0_L_R = player0x.g dim _P0_U_D = player0y.h title drawscreen if joy0fire then goto begin goto title begin COLUPF=rand z=0 player1x = 50 player1y = 80 player0x = 50 player0y = 20 missile1x=200 : missile1y=200 a=0 b=0 const pfscore=1 pfscore1 = 21 pfscore2 = 255 pfscorecolor=$44 COLUP0=rand missile1y=200 : missile1x=200 COLUBK=$00 k=0 main scorecolor=$0E playfield: .....X.XXXXXXXXXXXXXXXXXX.X..... .....X.XXXXXXXXXXXXXXXXXX.X..... .....X.XXXXXXXXXXXXXXXXXX.X..... .....X.XXXXXXXXXXXXXXXXXX.X..... .....X.XXXXXXXXXXXXXXXXXX.X..... .....X.XXXXXXXXXXXXXXXXXX.X..... .....X.XXXXXXXXXXXXXXXXXX.X..... .....X.XXXXXXXXXXXXXXXXXX.X..... .....X.XXXXXXXXXXXXXXXXXX.X..... .....X.XXXXXXXXXXXXXXXXXX.X..... .....X.XXXXXXXXXXXXXXXXXX.X..... end if a=0 then player0: %00000000 %00000000 %00000000 %00100100 %00111100 %01111110 %11111111 %00100100 %00100100 %00100100 %00111100 %00111100 %00011000 %00011000 %00011000 %00011000 end if a = 2 then player0: %00000000 %00000000 %00000000 %00000000 %00110011 %00110011 %11001100 %11001100 %00110011 %00110011 %11001100 %11001100 %00110011 %00110011 %11001100 %11001100 end if z=0 then f=f+1 if f = 10 then player1: %00000000 %00000000 %00000000 %00000000 %00000000 %00000000 %00000000 %00000000 %00000000 %00000000 %00000000 %00011000 %00011000 %00011000 %00111100 %01111110 %11100111 %11100111 %01100110 %00100100 %00011000 %00011000 %00011000 %00011000 %00011000 end if f = 10 then player1color: $BE; $BE; $BE; $BE; $BE; $BE; $BE; $BE; $BE; $BE; $BE; $BE; $1E; $1E; $1E; $94; $94; $94; $94; $94; $1E; $1E; $1E; $1E; $1E; end if f = 20 then player1: %00000000 %00000000 %00000000 %00000000 %00000000 %00000000 %00000000 %00000000 %00000000 %00000000 %00010000 %00011000 %00011000 %00011000 %00111100 %01111110 %11100111 %11100111 %01100110 %00100100 %00011000 %00011000 %00011000 %00011000 %00011000 end if f = 20 then player1color: $BE; $BE; $BE; $BE; $BE; $BE; $BE; $BE; $BE; $BE; $BE; $BE; $1E; $1E; $1E; $94; $94; $94; $94; $94; $1E; $1E; $1E; $1E; $1E; end if f = 30 then player1: %00000000 %00000000 %00000000 %00000000 %00000000 %00000000 %00000000 %00000000 %00000000 %00001000 %00010000 %00011000 %00011000 %00011000 %00111100 %01111110 %11100111 %11100111 %01100110 %00100100 %00011000 %00011000 %00011000 %00011000 %00011000 end if f = 30 then player1color: $BE; $BE; $BE; $BE; $BE; $BE; $BE; $BE; $BE; $BE; $BE; $BE; $1E; $1E; $1E; $94; $94; $94; $94; $94; $1E; $1E; $1E; $1E; $1E; end if f = 40 then player1: %00000000 %00000000 %00000000 %00000000 %00000000 %00000000 %00000000 %00000000 %00010000 %00001000 %00010000 %00011000 %00011000 %00011000 %00111100 %01111110 %11100111 %11100111 %01100110 %00100100 %00011000 %00011000 %00011000 %00011000 %00011000 end if f = 40 then player1color: $BE; $BE; $BE; $BE; $BE; $BE; $BE; $BE; $BE; $BE; $BE; $BE; $1E; $1E; $1E; $94; $94; $94; $94; $94; $1E; $1E; $1E; $1E; $1E; end if f = 50 then player1: %00000000 %00000000 %00000000 %00000000 %00000000 %00000000 %00000000 %00001000 %00010000 %00001000 %00010000 %00011000 %00011000 %00011000 %00111100 %01111110 %11100111 %11100111 %01100110 %00100100 %00011000 %00011000 %00011000 %00011000 %00011000 end if f = 50 then player1color: $BE; $BE; $BE; $BE; $BE; $BE; $BE; $BE; $BE; $BE; $BE; $BE; $1E; $1E; $1E; $94; $94; $94; $94; $94; $1E; $1E; $1E; $1E; $1E; end if f = 60 then player1: %00000000 %00000000 %00000000 %00000000 %00000000 %00000000 %00010000 %00001000 %00010000 %00001000 %00010000 %00011000 %00011000 %00011000 %00111100 %01111110 %11100111 %11100111 %01100110 %00100100 %00011000 %00011000 %00011000 %00011000 %00011000 end if f = 60 then player1color: $BE; $BE; $BE; $BE; $BE; $BE; $BE; $BE; $BE; $BE; $BE; $BE; $1E; $1E; $1E; $94; $94; $94; $94; $94; $1E; $1E; $1E; $1E; $1E; end if f = 70 then player1: %00000000 %00000000 %00000000 %00000000 %00000000 %00001000 %00010000 %00001000 %00010000 %00001000 %00010000 %00011000 %00011000 %00011000 %00111100 %01111110 %11100111 %11100111 %01100110 %00100100 %00011000 %00011000 %00011000 %00011000 %00011000 end if f = 70 then player1color: $BE; $BE; $BE; $BE; $BE; $BE; $BE; $BE; $BE; $BE; $BE; $BE; $1E; $1E; $1E; $94; $94; $94; $94; $94; $1E; $1E; $1E; $1E; $1E; end if f = 80 then player1: %00000000 %00000000 %00000000 %00000000 %00010000 %00001000 %00010000 %00001000 %00010000 %00001000 %00010000 %00011000 %00011000 %00011000 %00111100 %01111110 %11100111 %11100111 %01100110 %00100100 %00011000 %00011000 %00011000 %00011000 %00011000 end if f = 80 then player1color: $BE; $BE; $BE; $BE; $BE; $BE; $BE; $BE; $BE; $BE; $BE; $BE; $1E; $1E; $1E; $94; $94; $94; $94; $94; $1E; $1E; $1E; $1E; $1E; end if f = 90 then player1: %00000000 %00000000 %00000000 %00001000 %00010000 %00001000 %00010000 %00001000 %00010000 %00001000 %00010000 %00011000 %00011000 %00011000 %00111100 %01111110 %11100111 %11100111 %01100110 %00100100 %00011000 %00011000 %00011000 %00011000 %00011000 end if f = 90 then player1color: $BE; $BE; $BE; $BE; $BE; $BE; $BE; $BE; $BE; $BE; $BE; $BE; $1E; $1E; $1E; $94; $94; $94; $94; $94; $1E; $1E; $1E; $1E; $1E; end if f = 100 then player1: %00011000 %00011000 %00011000 %00011000 %00011000 %00011000 %00011000 %00011000 %00011000 %00011000 %00011000 %00011000 %00011000 %00011000 %00111100 %01111110 %11100111 %11100111 %01100110 %00100100 %00011000 %00011000 %00011000 %00011000 %00011000 end if f = 100 then player1color: $BE; $BE; $BE; $BE; $BE; $BE; $BE; $BE; $BE; $BE; $BE; $BE; $1E; $1E; $1E; $94; $94; $94; $94; $94; $1E; $1E; $1E; $1E; $1E; end if f=100 then z=1 if z=1 then f=100 else z=0 drawscreen if player0y>90 then player0y=0 : player0x=rand : b = (rand&3) : a=0 : score=score+5 if f<=10 then _P0_U_D = _P0_U_D + 0.50 if f>=20 then _P0_U_D = _P0_U_D + 0.55 if f>=30 then _P0_U_D = _P0_U_D + 0.60 if f>=40 then _P0_U_D = _P0_U_D + 0.65 if f>=50 then _P0_U_D = _P0_U_D + 0.70 if f>= 60 then _P0_U_D = _P0_U_D + 0.75 if f>= 70 then _P0_U_D = _P0_U_D + 0.80 if f>= 80 then _P0_U_D = _P0_U_D + 0.85 if f>=90 then _P0_U_D = _P0_U_D + 0.90 if f=100 then _P0_U_D = _P0_U_D + 1.00 if b=0 then player0x=player0x+1 if b=1 then player0x=player0x-1 if player0y<10 && player0x<49 then player0x=rand if player0y<10 && player0x>110 then player0x=rand if b=3 then player0x=player0x-1 if collision(player1,player0) && a=0 then z=0 : f=0 : player1y=player1y+5 : score=score+10 : a=2 : pfscore1 = pfscore1/4 if d=0 && player0x<49 then b=0 if d=0 && player0x>110 then b=1 if d=1 && player0x<49 then b=0 if d=1 && player0x>100 then b=1 if d=2 && player0x<49 then b=0 if d=2 && player0x>85 then b=1 if d=3 && player0x<49 then b=0 if d=3 && player0x>85 then b=1 if missile0y<200 then missile0y=missile0y-1 if pfscore1=0 then missile0y=200 : missile0x=200 if joy0right then player1x = player1x + 1 if joy0left then player1x = player1x - 1 if joy0up then player1y=player1y - 1 if joy0down then player1y=player1y + 1 if !joy0fire then _Bit1_FireB_Restrainer{1} = 0 : goto __Skip_Fire if _Bit1_FireB_Restrainer{1} then goto __Skip_Fire _Bit1_FireB_Restrainer{1} = 1 __Skip_Fire goto main Quote Link to comment Share on other sites More sharing options...
ultima Posted February 3, 2015 Share Posted February 3, 2015 The part where your checking the f variable could be done as a subroutine then you could also remove each player graphic out as a sub called by the sub check on f. It should free up the cpu from reading all the player graphics and instead call one check on f and send it to the appropriate frame then return back in the loop.. Quote Link to comment Share on other sites More sharing options...
Retro Lord Posted February 3, 2015 Author Share Posted February 3, 2015 Cheers for the tip =) Quote Link to comment Share on other sites More sharing options...
+SpiceWare Posted February 3, 2015 Share Posted February 3, 2015 Easiest is to have a variable that keeps track of the current acceleration. This is psuedocode as I don't use bB. // accelerate if gas petal is pressed, but only to the maximum acceleration rate (1.00 for this example, use whatever max value makes sense for your program) if (gas_pedal_depressed) then accel = accel + 0.05 if (accel > 1.00) then accel = 1.00 // decelerate if brake petal is pressed. if (brake_depressed) then accel = accel - 0.03 if (accel < 0.00) then accel = 0.00 positionY = positionY + accel Quote Link to comment Share on other sites More sharing options...
Retro Lord Posted February 3, 2015 Author Share Posted February 3, 2015 Thanks a million guys, I got it working now, you are the best =) Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.