-1

I am programming Chess and wanted to know how I can change the spot of my rectangles. If you need any more informations let me know in the answers. I would be really happy if I could get any answers that could help me. Thanks.

  • _[How do I ask a good question?](http://stackoverflow.com/help/how-to-ask)_ –  Mar 24 '15 at 12:48
  • I have removed tag(s) from your question's title based on _[Should questions include “tags” in their titles?](http://meta.stackexchange.com/questions/19190/should-questions-include-tags-in-their-titles)_ where the consensus is **no** _they should not_. –  Apr 02 '15 at 00:39

1 Answers1

0

A rectangle has an int x and y component. They represent the position on the screen. x: 0, y: 0 represents the upper left corner of the screen. They're measured in pixels.

Example(assumingly in Game class)

Rectangle chessPiece1;
// in init function:
chessPiece1.x = 100;

You'll see that the chess piece has moved 100 pixels to the right on the screen(if you've drawed of course).

// if you put this in the update function, your chess piece will move 1 pixel to the right every time the update function is called!
chessPiece.x++;

And you can do this in the y direction too.

More info here. Also: I assume you are new to stackoverflow, people can be a little harsh if you ask "fix this for me please". Here's some info on how to make neat questions.

Community
  • 1
  • 1
joppiesaus
  • 5,471
  • 3
  • 26
  • 36
  • 1
    _"Here's some info on how to make neat questions"_ - is actually pointing to MSDN `Rectangle` class help. Did you mean to link to SO? ;) –  Mar 23 '15 at 07:25
  • 1
    @MickyDuncan Oh man I should learn again how to use CTRL C and CTRL V. – joppiesaus Mar 23 '15 at 09:02