Add mrsh sprite #4
11
src/main.c
11
src/main.c
@@ -38,6 +38,9 @@ int main ()
|
|||||||
int positionXCollectible = GetRandomValue(0, 600);
|
int positionXCollectible = GetRandomValue(0, 600);
|
||||||
int positionYCollectible = GetRandomValue(0, 800);
|
int positionYCollectible = GetRandomValue(0, 800);
|
||||||
|
|
||||||
|
// Character controller settings
|
||||||
|
int speed = 2;
|
||||||
|
|
||||||
|
|
||||||
// game loop
|
// game loop
|
||||||
while (!WindowShouldClose()) // run the loop until the user presses ESCAPE or presses the Close button on the window
|
while (!WindowShouldClose()) // run the loop until the user presses ESCAPE or presses the Close button on the window
|
||||||
@@ -68,21 +71,21 @@ int main ()
|
|||||||
//up
|
//up
|
||||||
if (IsKeyDown(74) && VerticalPosition != 580 ) {
|
if (IsKeyDown(74) && VerticalPosition != 580 ) {
|
||||||
// draw some text using the default font
|
// draw some text using the default font
|
||||||
VerticalPosition = VerticalPosition+10;
|
VerticalPosition = VerticalPosition+speed;
|
||||||
};
|
};
|
||||||
//down
|
//down
|
||||||
if (IsKeyDown(75) && VerticalPosition != 0) {
|
if (IsKeyDown(75) && VerticalPosition != 0) {
|
||||||
VerticalPosition = VerticalPosition-10;
|
VerticalPosition = VerticalPosition-speed;
|
||||||
// draw some text using the default font
|
// draw some text using the default font
|
||||||
};
|
};
|
||||||
//left
|
//left
|
||||||
if (IsKeyDown(72) && HorizontalPosition != 0) {
|
if (IsKeyDown(72) && HorizontalPosition != 0) {
|
||||||
HorizontalPosition = HorizontalPosition-10;
|
HorizontalPosition = HorizontalPosition-speed;
|
||||||
// draw some text using the default font
|
// draw some text using the default font
|
||||||
};
|
};
|
||||||
//right
|
//right
|
||||||
if (IsKeyDown(76)&& HorizontalPosition != 780) {
|
if (IsKeyDown(76)&& HorizontalPosition != 780) {
|
||||||
HorizontalPosition = HorizontalPosition+10;
|
HorizontalPosition = HorizontalPosition+speed;
|
||||||
// draw some text using the default font
|
// draw some text using the default font
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user