bogax Posted March 3, 2015 Share Posted March 3, 2015 Here's some Bresenham type movement code This moves player0 towards player1 while joy0fire is pressed When a collision occurs the players are repositioned randomly and paused for 1 second The setup_move code computes the absolute value of delta x and delta y from x0,y0 and x1,y1 and sets a bit in f for each to indicate if they were positive or negative it then sets a bit according to which is larger. This determines the octant we're moving in and is used to lookup the direction of movement (+1, -1) in the xinc and yinc tables The playfield pixels are the octant were moving in (the f variable) and some reference pixels to show which bits are which (var40 = %01010101) (I did this for my own purposes but when I Googled for similar stuff in bB I found nothing so I thought I'd share it in case some else wants something like) move.bas move.bin 3 Quote Link to comment Share on other sites More sharing options...
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.