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 20:12] – [Handling motion] dwhite26notes: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 83: Line 87:
 ====Handling motion==== ====Handling motion====
 To handle motion you could do: To handle motion you could do:
-<code/n>+<code c> 
 +int SnakeX; 
 + 
 + 
 +if( Right) 
 +
 + 
 +  SnakeX = SnakeX + 20; 
 + 
 + 
 +
 +</code>
 ====Score Display==== ====Score Display====
  
notes/comporg/spring2024/projects/mpg0.1707336751.txt.gz · Last modified: 2024/02/07 20:12 by dwhite26