How To

How do you make it shoot?


japanese 2022-01-07 08:46

I'm studying about this program now, but i can't understand about how to shoot.
I think if shooting, the bullet's x-coordinate must increase.
i can't express it well…

nathanielbabiak 2022-01-08 01:52

these boards are pretty dead lately, I'll upload something in a little bit, and try to give some explanation

nathanielbabiak 2022-01-08 02:54 (Edited)

Hey, let me know if you have any questions!

  1. The main game loop runs continuously, once per frame. It is shown on line 121 (CTRL+F 'GAME LOOP) through line 172.

  2. Within the main game loop, a subprogram is called. It updates the player's variables. ​It is shown on line 155 (CTRL+F CALL UPDPLAYER). The subprogram is shown on lines 179 (CTRL+F SUB UPDPLAYER) through line 236.

  3. The shooting code begins within the UPDPLAYER subprogram. It is shown on line 200 (CTRL+F 'SHOOT?) through line 217. This code uses the variable BULLET to keep track of the next available bullet that can be fired by the player. The bullet is set to X and Y coordinates using the line SPRITE BULLET+2,PX+8,PY+11,3.

  4. The shooting code updates the bullet X and Y coordinates within a different subprogram! Returning to the main game loop, another subprogram runs on line 151 (CTRL+F CALL UPDDBULLETS). (Because the main game loop cycles continuously, it doesn't matter that the begin subprogram and the update subprogram are not sequential.)

  5. The update code is on line 267 (CTRL+F SUB UPDBULLETS) through line 274. This code increases the X coordinate of each bullet by 3, shown on the line SPRITE I,SPRITE.X(I)+3,,.

japanese 2022-01-08 13:26

thanks a lot! you r very helpful! i overlooked SUB UPDBULLETS.

Log in to reply.