User Tools

Site Tools


notes:comporg:spring2024:projects:mpg0

Differences

This shows you the differences between two versions of the page.

Link to this comparison view

Both sides previous revisionPrevious revision
Next revision
Previous revision
notes:comporg:spring2024:projects:mpg0 [2024/02/07 01:31] – [Gamepad input] gsalcenotes:comporg:spring2024:projects:mpg0 [2024/02/08 02:32] (current) – [Game loop] rspringe
Line 7: Line 7:
  
 ====Game loop==== ====Game loop====
 +For this project, you will be making a Snake game.
  
 +The game loop for Snake is simple: you will control a snake around the screen to eat pieces of food. Once a piece of food has been eaten, your score will increase, and the snake will get longer.
 +
 +The game ends when the head of the snake runs into either a wall, or another part of its body.
 ====Sprites==== ====Sprites====
  
Line 54: Line 58:
 <code bash> <code bash>
 if( var == 1 ) { if( var == 1 ) {
-  Snake.X -= PlayerSpeed;+  Snake[0].X -= PlayerSpeed;
 } }
 </code> </code>
Line 82: Line 86:
 The screen on vircon32 is 640 by 360, however, you do not have to type these out every time you make a game in vircon32 as they are stored in the screen_width and screen_height variables respectively. One way of bounds checking is to see where you are about to spawn the snake's head, if it is within the screen window then it is fine. However, if it is outside that window then game over. The screen on vircon32 is 640 by 360, however, you do not have to type these out every time you make a game in vircon32 as they are stored in the screen_width and screen_height variables respectively. One way of bounds checking is to see where you are about to spawn the snake's head, if it is within the screen window then it is fine. However, if it is outside that window then game over.
 ====Handling motion==== ====Handling motion====
 +To handle motion you could do:
 +<code c>
 +int SnakeX;
  
 +
 +if( Right)
 +{
 +
 +  SnakeX = SnakeX + 20;
 +
 +
 +}
 +</code>
 ====Score Display==== ====Score Display====
  
notes/comporg/spring2024/projects/mpg0.1707269471.txt.gz · Last modified: 2024/02/07 01:31 by gsalce