Game board | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
0

Game board

Hi folks, I want to know if someone knows how to move characters inside a Array 2D, please I want to do a game board.

16th Jul 2018, 9:44 AM
アレキサンダー
アレキサンダー - avatar
5 Answers
+ 2
assuming each index is one tile in your board game, when user presses left you set his position in array like arr[playerIndexX -1][playerIndexY] = player; it should be simple. ______|___X__|__Y| LEFT | -1 | 0 | ______ |______|____| RIGHT | 1 | 0 | _______|______|____| UP | 0 | 1 | ______|______|____| DOWN | 0 | -1 | _______|______|____| These are the values you should add to player indexes. For diagonal moves just combine two values ex. Up and Right
16th Jul 2018, 10:07 AM
Jakub Stasiak
Jakub Stasiak - avatar
0
Cool
22nd Jul 2018, 4:56 AM
アレキサンダー
アレキサンダー - avatar
0
Have not you something more complete to me see it in function?
22nd Jul 2018, 4:57 AM
アレキサンダー
アレキサンダー - avatar
0
I see a video in YouTube of a Chess called "Chess MS", awesome game, that inspired me, this game has 2 new pieces, Prince and Princess, I would like to do this kind of game.
22nd Jul 2018, 5:00 AM
アレキサンダー
アレキサンダー - avatar
0
Thanks for your feedback!
22nd Jul 2018, 5:01 AM
アレキサンダー
アレキサンダー - avatar