Captain Spazer Posted August 18, 2021 Share Posted August 18, 2021 Experimenting with a basketball engine, I got dribbling half-working, as long as you move left or right it works, but when you move up or down the ball won't move up and down anymore, any ideas? set kernel_option no_blank_lines player0y = 50: player0x = 50 a = 10 ballx = 80 : bally= 50 dim p1_own_ball = c dim p1_shoot_ball = d dim ball_bounce = e p1_own_ball = 0 main ballheight = 4 CTRLPF = $21 COLUBK=$86 COLUPF=$26 COLUP0=$0E if a = 10 then player0: %00000000 %00000000 %00110000 %00100000 %01010000 %01111100 %00001110 %00011100 %00011000 %00011000 %10011011 %10011100 %01011000 %00000000 %00011000 %00011000 end if a = 20 then player0: %00000000 %00000000 %00110110 %00100100 %00010010 %00010100 %00001100 %00011000 %00011000 %00011000 %10011011 %10011100 %01011000 %00000000 %00011000 %00011000 end playfield: ................................ ................................ ..X..........................X.. ..XX........................XX.. ..X..........................X.. ..X..........................X.. ..X..........................X.. ................................ ................................ ................................ ................................ end if a = 30 then a = 0 drawscreen rem PLAYER0 ANIMATION FRAME COUNTER a = a + 1 rem flip player0 sprite if b = 0 then REFP0 = 0 if b = 1 then REFP0 = 8 rem PLAYER0 CONTROLS if joy0right then player0x = player0x + 1 : b = 0 if joy0left then player0x = player0x - 1 : b = 1 if joy0up then player0y = player0y - 1 if joy0down then player0y = player0y + 1 if collision(player0,ball) && p1_own_ball = 0 then p1_own_ball = 1 : ball_bounce = 2 if p1_own_ball = 1 && b = 0 then ballx = player0x + 9 if p1_own_ball = 1 && b = 1 then ballx = player0x - 2 rem ball bounces up if p1_own_ball = 1 && bally > player0y-1 then ball_bounce = 1 rem ball bounces down if p1_own_ball = 1 && bally < player0y - 5 then ball_bounce = 2 if p1_own_ball = 1 && ball_bounce = 1 then bally = bally - 1 if p1_own_ball = 1 && ball_bounce = 2 then bally = bally + 1 goto main Source: Bball.bas Bin: Bball.bin Quote Link to comment https://forums.atariage.com/topic/324034-basketball-engine-dribble-handling/ Share on other sites More sharing options...
Captain Spazer Posted August 18, 2021 Author Share Posted August 18, 2021 Fixed the issue by slowing down the player. Dribbling works flawlessly now, and by pushing the joystick you can now jump with the ball to line up a shot. Source:Bball 0.2.bas Bin: Bball 0.2.bin Feel free too use the source in order to help you make your own game of basketball. 1 Quote Link to comment https://forums.atariage.com/topic/324034-basketball-engine-dribble-handling/#findComment-4888238 Share on other sites More sharing options...
Captain Spazer Posted August 18, 2021 Author Share Posted August 18, 2021 More improved engine: Hold the fire button when jumping and then release to shoot the ball, if it hits its mark, the background color changes indicating the ball hit the x, y position to score. Bball 0.3.binBball 0.3.bas Quote Link to comment https://forums.atariage.com/topic/324034-basketball-engine-dribble-handling/#findComment-4888278 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.