User Tools

Site Tools


notes:comporg:spring2025:projects:mtb2

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:spring2025:projects:mtb2 [2025/02/26 14:56] – [difficulty of computer player] tkastne1notes:comporg:spring2025:projects:mtb2 [2025/02/28 05:03] (current) – [score storage] bdildine
Line 6: Line 6:
 For our purposes, we can check if the ball's x position has exceeded 640 or subceeded 0 For our purposes, we can check if the ball's x position has exceeded 640 or subceeded 0
 ====score storage==== ====score storage====
 +You can store the score and other variables you may use such as x and y positions to locations in memory by defining it, for example: 
 +<code> 
 +%define LScore    0x00000000 
 +</code> 
 +You can then load each score into a register before use so you can use the same score tracking function for both the right and left players scores by loading different scores before calling the function.
 ====score display==== ====score display====
 Displaying the player's scores is where things start to get more complex, as we no longer have built in 'itoa' or 'print' functions, so we will have to build them manually. Displaying the player's scores is where things start to get more complex, as we no longer have built in 'itoa' or 'print' functions, so we will have to build them manually.
Line 66: Line 70:
 First we need to get the difference in position between the paddle and the ball. First we need to get the difference in position between the paddle and the ball.
  
-NOTE* we want the center of the paddle to hit the center of the ball, so we must make sure to compensate for the distance between the hotpots and centers of the paddle+*NOTE* we want the center of the paddle to hit the center of the ball, so we must make sure to compensate for the distance between the hotpots and centers of the paddle
  
 This will tell us the direction and magnitude the paddle should move, but we will want to cap the movement speed of the paddle so the bot isn't too good. This will tell us the direction and magnitude the paddle should move, but we will want to cap the movement speed of the paddle so the bot isn't too good.
Line 85: Line 89:
    idiv  RT,    3    ;This will make the bot 2/3 the responsive    idiv  RT,    3    ;This will make the bot 2/3 the responsive
        
-   imax  RT,  -10    ;Limit the speed to -10 pixels and 10 pixels+   imax  RT,  -10    ;Limit the speed to -pixels and pixels
    imin  RT,   10    imin  RT,   10
        
Line 94: Line 98:
 ====difficulty of computer player==== ====difficulty of computer player====
 The difficulty of the computer can be tuned by changing the max speed and responsiveness during their movement step The difficulty of the computer can be tuned by changing the max speed and responsiveness during their movement step
 +
 +Another way to increase difficulty is to have the ball move faster or have a smaller paddle. You could also give the computer player a larger paddle.
notes/comporg/spring2025/projects/mtb2.1740581768.txt.gz · Last modified: 2025/02/26 14:56 by tkastne1