Sign in to follow this  

Moving diagonally (Chess) logic

Recommended Posts

Hey everyone, I'm writing a simple chess clone and I'm not sure how to implement the diagonal moving. I already made the Pawn, Knight, and Rook, but I'm having trouble on figuring out the diagonal moving through a 2d array. Anyone have an algorithm or guide on implementing diagonal moves? Thanks! (I'm working on the Bishop now)

EDIT: A shower later and I just realized the same way I did the attacking for the Pawn is how I would do the diagonals for the Bishops. Sometimes typing the question out and a nice shower helps get the brain working haha! Thanks anyway! Edited by SonicD007

Share this post

Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

Sign in to follow this