Hello, I am new to C and C++ and want to get into game
programming so I found this tutorial at SDL's website called "Help! How Do I Move An Image?". The problem is it is python and I want to learn how to program games in C or C++.
This is what I have so far
This is what I get:Code:#include <stdlib.h> #include <stdio.h> int main() { int screen[8] = { 1, 1, 1, 1, 2, 2, 2, 2 }; //the map array int x,y,a; int playerpos; //players position playerpos = 3; //set players starting point to the fourth element in the array screen[playerpos] = 8; // make the hero a mighty 8 :) for( x = 0; x < 8; x++ ) // loop to see if this works { printf(" %d ", screen[x]); } //loop worked now we try to move 8 y = playerpos; //copy playerpos to a variable playerpos = y - 1; // move playerpos to the left screen[playerpos] = 8; //shape shifting isnt allowed printf("\n"); //new line to compare for( a = 0; a < 8; a++ ); { printf(" %d ", screen[a]); } system("PAUSE"); return 0; }
1 1 1 8 2 2 2 2
37814176
Press any key to continue . . .
8 was supposed to move left but it didnt.
Thanks to all who apply in advance.



LinkBack URL
About LinkBacks
.


