Please sign in to access this page

PyShooter

PyShooter Used AI

10 devlogs
10h 43m
Created by Kush Ray

A shooter game with different abilities.

Timeline

this session, I added a shield powerup. This was relatively easy, and I also added a new sprite with a shield look that updates when the shield is active. I got the code to work by adding to the if statements, that health is only lost if the sheaf condition is false. Next up, add visual timers for the powerups.

Update attachment

I spent this session making a health boost. I started by making a sprite and drawing it onto the screen at a random spot. I then used the collision detection logic from before to increase the health when the player collects the heart. I then spend the most time making it so the heart would appear randomly at random time intervals. I used the pygame.time.get_ticks() function, but that led to some bugs. I managed to fix it by adding a second condition so the if command only runs once (and is more accurate). I finally got it to work, with the heart randomly appearing at random times, and giving +1 health when collected. Next up, adding a shield powerup (or something else?).

Update attachment

I added a powerup this session. I added an ability to rapid fire for five second on the press of a key. The main problem i faced was the time limit, since I already used a time function for another ability. This time, I had to make another variable for the time to make this work. I also had to redefine the bullet to make sure it appeared on the screen and acted correctly. I also spent some time playing around to see what else I can do to add spice to the game. (For example, I played around with changing the screen size as a power up). Next up, more powers, or adding limits to using powers. (or other pickup able things).

Update attachment

This session, I added a health bar. I used the draw function to make a rectangle, and changed the width of the rectangle based on the health value. I also positioned the health bar so it follows right above the player. Then I added an end screen if you lose all your health. I made so it shows Game Over and then your final score. I also made it so the health bar only shows once you take damage. Next up, making the game harder and more adaptive (and possible adding more abilities).

Update attachment

In this session, I added text to the screen to show the score. I started by using a new file to test how to add text, and then incorporated the code into my game file. I changed the size, color, and layering so the score is shown as part of the background. I also made it so the score increases every time you hit an enemy. Next up, adding a health bar.

Update attachment

This session, I added collision detection to my game. I started by trying to use masks, but that was too complicated and did not work. Instead, I decided to use make a rect for each object and detect that. The main problem I faced was detecting all items in a list, no just the latest one. I fixed this by adding the detection in the action in creating each object (using a nested loop). After detecting collision for the projectile and enemy, I coded it for both that projectile and enemy to disappear. I used the same logic to detect player/enemy collision and remove the enemy if that happens. (with some troubleshooting so it detects at all times). In the end, I got the collision detection to work and applied actions if collision is detected. Next up, adding code to change score/health and display them on the screen.

Update attachment

I worked on adding enemies to my game. I then made it so the enemy will always follow the player around. I also made it so the enemies randomly spawn inside the screen. Then, using the lists I learned about last time, I made a list to spawn a certain number of enemies at a time, all of them following the player. Next up, add collision detection for taking and dealing damage.

Update attachment

This session, I worked on adding a projectile. I started by drawing a simple circle, and coded it to appear on the position of the player when I press a key. Then I used trig to code the projectile to move toward the mouse. Since I am new at python, I worked step by step, first making a circle, then changing the location, then moving it, then aiming it. I also drew it multiple times to add a blur effect. I wanted to make multiple projectiles, so doing some research, I learned about lists. I learned how to use a list and made one to launch multiple projectiles. I updates the code and tweaked a few things and finally got multiple projectiles that launch at the mouse.

Update attachment

I replaced the circle with a custom made sprite. Then I had to figure out how to rotate the sprite to face my mouse. After doing this, I wanted to add powerups. I wrote a script that increases the speed of the player after pressing q. I wanted it to only last a few seconds, and after some research how to do that, I was able to accomplish a powerup activated for a limited time. Next up, add a projectile to launch.

Update attachment

I started making my first python game. This is the first time I am making a game in python, so it is taking some time to learn the mechanics. I manages to make a screen and player, and move the player using the wasd keys. I also set a boundary so the player does not leave the screen. Next up, make a sprite and rotate it.

Update attachment