PacManPlus Posted March 17, 2017 Share Posted March 17, 2017 (edited) Hey guys: I have an instance where lightning is going to come from off the top of the screen down to a pre-determined random point on the screen. Also, it is all going to be done with 'tiles' (i.e. no sprites). I've already limited the destination point to a tile interval, but what I'm trying to find is: The X and Y interval to place the tiles from the very top of the screen where the lightning starts (a random X value, but Y is always zero) to the tile on the screen where the lightning is supposed to 'hit'. I know that I should know this, but I can't think of the algorithm... Does anyone know? Thanks, Bob Edited March 17, 2017 by PacManPlus Quote Link to comment Share on other sites More sharing options...
danwinslow Posted March 17, 2017 Share Posted March 17, 2017 http://www.coolmath.com/algebra/08-lines/06-finding-slope-line-given-two-points-01 You will probably find this in any drawline code in some fashion. Quote Link to comment Share on other sites More sharing options...
PacManPlus Posted March 17, 2017 Author Share Posted March 17, 2017 (edited) Ouch - I know I should have remembered this from my Algebra days... (Granted, it's been over 30 years) ...wow I feel stupid right now Thank you very much for the response. Edited March 17, 2017 by PacManPlus Quote Link to comment Share on other sites More sharing options...
RevEng Posted March 17, 2017 Share Posted March 17, 2017 You might want to look up Bresenham's line algorithm too. 1 Quote Link to comment Share on other sites More sharing options...
PacManPlus Posted March 17, 2017 Author Share Posted March 17, 2017 Thanks! Although Bresenham's line algorithm reminded me... Now I actually feel even more ridiculous (if that's even possible) - as I forgot that I already asked this question when I was working on PinOut and Asteroids Deluxe ... wow what's going on with my memory lately? Quote Link to comment Share on other sites More sharing options...
RevEng Posted March 17, 2017 Share Posted March 17, 2017 Now you have sample code to look at, too. My grey cells aren't as faithful as they once were, either. Roll with it, I guess. 1 Quote Link to comment Share on other sites More sharing options...
PacManPlus Posted March 17, 2017 Author Share Posted March 17, 2017 lol thanks 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.