Barrel Roll Bullet
- 33 Devlogs
- 98 Total hours
Barrel Roll Bullet - Shoot, soar and spin in this chaotic precise platformer where movement is controlled through gun recoil.
Barrel Roll Bullet - Shoot, soar and spin in this chaotic precise platformer where movement is controlled through gun recoil.
Dev Log #33
.
As you can probably guess, I have done alot
I have done the following:
• Gave all levels the correct level variables
• Made buttons work correctly when rotated
• Made teleport bullets work as intended
• Made gates and broken tiles allow bullets to pass through when collision is removed
• Created an EXE file of my game for friends to use for playtesting
• Made a stat tracker to use playtest information to improve my game
• Corrected all file directories that had to be moved for PyInstaller to work properly
• Fixed the Easter egg room so it now loads correctly
• Added AI declaration comments and a Google Doc
That is a lots, so let me quick fire explain how i did them
for tile in Tiles.tiles:
if self.rect.colliderect(tile["rect"]):
tile_property = tile["property"].get("type")
if tile_property in Tiles.open_gates:
continue
Dev Log #32
.
Made 50 levels today, that is all.
.
Every 3 levels, a new ability/feature is added. This allows the player to get used to the new thing added, making their later appearance managble as the player is now used to how they function.
.
I have not set the player and goal location co-ordinates for each level, or other variables like if mini stars are required.
.
That’s all for today.
Dev Log #31
.
I AM FINISHED!!!
.
Well, pretty much at least.
.
Today I:
Completed the Waiver
Made some more levels
I made it so that the text box works with word wrap, enter key and backspace key.
.
I did this by splitting the text into words and lines, then checking each word’s width against the rect boundaries.
.
If the word exceeds the boundaries x, the texts’ x position is reset and the Y-coordinate is incremented, creating a new line.
.
The Enter key creates a new line by resetting x and incrementing y, while Backspace removes the last character from the text string, preventing it from being displayed.
.
The waiver now checks if all fields are filled and allows you to press a button that is connected to a hyperlink that will, in the future, take you to a video created my me showing how each level is complete.
.
Also made 12 levels today, each new feature is slowly implemented one at time.
.
That’s all for today.
Dev Log #30
.
The big 30!!!
.
Done quite a bit today, just last bit of polishing and then we move towards UI, music, level design, ect.
.
Today I:
FINISHED THE DIALOGUE SYTEM
Added a leave waiver button (was a softlock)
Added a text box to waiver [WIP]
Dialogue system works fully (minus sound but thats still a win in my books). Plays on level start and level completion and once dialogue is viewed by the player, it is not shown to them again.
.
Mouse can be clicked to remove dialogue from the screen, without triggering bullet fire.
.
Also fixed the issue of the text backround being displayed on re-entry and re-completion of the level, but fixed that easily with a variable, setting it to true or false if level had already been completed, then only displaying the text bg when it was true.
.
Waiver leave button pretty simple, basic pygame rect collidepoint detection.
.
Text box sets text_active to true on mouse click, mouse clicks anywhere else set it to false, meaning player can only type when they have clicked on it (when they want to).
.
I appened every event.unicode into a list on key press, meaning I had a list of the players key storkes, then screen.blitted each letter in the list.
.
Final touches are making all fields complete required to acess button that is a hyperlink to video of me completing stages with instuctions to help, and also backspace and enter and wordwrap working with the text_box.
.
Then I think I’m done for the most part on the coding side of things, and will move onto level creation.
.
The only thing I haven’t completed from my long list from a preious dev_log are:
Level editor
Upside down ability
James bond level start
Hint dialogue on multiple deaths
Boss fight
Not to say these aren’t going to be added but they are not simple things and will not really add to much to my game in all honesty. Given the deadline of end of this month I have given myself, I don’t know if I will have time to add these (except for the James bond level start thing as that is a UI thing that will require art, music ect so might work on that when not coding.
.
That’s all, thanks for reading (:
Dev Log #29
.
I’m pretty close to finishing the code side of my game now, the rest of my efforts will soon be focous toward things like:
Writing dialogue
Making nicer looking UI
Making tiles look good rather than coloured blocks
Animations
Music
Today I did the following:
Re made the dialogue system AGAIN
Created a gun selection screen
My dialogue system displays a word at a time and plays a short noise for each word shown, similarily to undertale voice blips. However, I think it sounds quite bad and I plan to replace it with a set dialogue sound that plays at the start, like animal crossing.
.
My dialogue system now plays on level start and level completion, and does not re-trigger on level repeat, using similar code used in my star tracking code.
.
Gun select code is similar to my level select code, using a different class but the same code, just changing the lock out code to only unlock once star count is >= button number - 1 * 6, so that each button is unlocked for each 6 stars earned, as well as having the default gun already unlocked.
.
That’s all for today, I hope to have a complete game by the end of the month so I can have this finished before the school year starts.
Dev Log #28
.
Didn’t do alot today, or for the 2 other days…
.
I finally made ghost bullets work correctly and have changed the dialogue sytem a bit
.
The ghost bullets working and not working previously was juts a matter of using variables inside the bullet class rather than global ones, making it work better for some reason, I had the assistance of a friend in fixing the issue, and safe to say it solved it
.
Dialogue sytem has only been changed slightly so not much point documenting the changes, spacing, timing of letters, ect.
.
Sorry for short devlog, I hope I have more tommorrow.
Dev Log #27
.
More things checked of the list today:
.
Today I did:
Added gravity flip ability
Added teleport bullets
Added player mission objectives
However, some other things i worked on today are still a work in progress, such as:
Diologue system
Ghost bullets (travel through walls)
Gravity flip works similarily to how slow time works, settings the variable self.gravity_flip to -1 on contact, then multiplying graivty strenght by it, reversing the direction of gravity
.
This however made my realign function not work when on the ceiling, so i added to re-align that if gravity_flip was negative, to detect ceiling hit rather than grounded, allowing it to work why gravity was flipped.
.
Teleport bullets work by setting a can teleport function to True on contact, then when true, if bullet collidesrect with tile, self.rect of bullet is equal to self.rect of gun. the can tele[port function is then set to false, making the ability only work once as intended.
.
Player mission objects are as follows:
Complete level
Complete level in set ammount of time
Complete level with less bullets than provided
This uses lists in a way i have never used them before and looks like this
total_stars = 0
level_stars = [[False, False, False] for _ in range(levels)]
If player completes level, level_stars[Settings.player_level - 1][0] for current player level is set to True.
.
If player completes level quickly (complete_time < bonus_time), then …[1] is set to true
.
If player reaches has_won game state with a number of bullets lower than the bullet max, then then …[2] is set to True.
.
Total stars is incremented by one for each goal completed, and if level_stars[Settings.player_level - 1][1,2 or 3] is already set to true, then the increment is skipped, meaning you can only get 3 stars per level.
.
That’s all for now, hope to fix the issues I had today in tomorrows devlog!!
Dev Log #26
.
Popped ULT today!!!
.
Today I added the following:
Slow time ability
Breakable surfaces
Bullet pickup
Fixed up dialogue system (Not fully complete)
Slow time ability works by setting a time to a decimal then multplying the following by it:
Velocity (Bullet + Player)
Rotation speed
Gravity strength
Multiplying by a decimal reduces the numbers, emulating slowed time rather than reducing fps which is a bit of a cop-out
.
Breakable surfaces work similarly to the gate tiles, the tiles having a alpha value of 0 when bullet rect makes contact with tile of that class and adding that tile type to a list: broken_tiles.
.
All tiles in that list are then ignored by tile collision
.
Bullet pickup works by detecting rect collision between the player and the surface, when contact is made the players bullet count (representing bullets shot total) is reduced by one, increasing the number of shots available to the player by one.
.
Dialogue system now works with full words, voice blips are annoying but will fix late stage when adding polish. Will also make it that player has to click mouse to go to next dialogue screen to give them time to read the text.
.
That is 3 and a bit things of the list, very good progress, juggling summer work, this and most importantly my Minecraft duties has been an upward hill battle but I’m getting there.
.
See you next develop with more progress!!!
Dev Log #25
.
My love for videojuegos has got the better of me.
.
Over theses 2 days all I have done is made some level maps and fixed the spawing positions of both win condition and the player based on the new maps.
.
But I have structure now, and rather than geting destracted, I have set myself some goals to complete hopefully by the end of the month, leaving me time to make the UI look nice.
.
I present to you. THE TOD0 LIST:
.
A - DIOLOGUE
- Fix dialogue system
- Add hint dialogue
- Add new level dialogue
- Add completed dialogue
B - ABILITIES/TILES
- Bullet Pickup
- Ghost bullets
- Teleport bullets
- Time SLOW (not stop)
- Gravity flip ?
- Map flip ?
- Breakable tiles
- Level editor ?
C - UI
- James bond level start animation
- Gun skin menu
- All menus with all required buttons
D - Miscellaneous
- Mission objectives (Bad piggies esque)
- Determine gun skin unlock criteria
- A FINAL BOSS !?!?!
I hope tomorrow if filled with WAY more advancements of the work kind rather than the Minecraft kind (;
Dev Log #24
.
A progress full day today, but mabye not for the best??
.
Today I done the following:
Added a charcater diologue box
Fixes re-align function so that it works when rotation direction is reversed
Just doing little sidequests for now as I’m trying to hide from my enemy, level design.
The things is I’m not very good at games, so i dont have the reaction time to create very punishing levels with little room for error.
.
So to combat this, I end up making really hard levels or super easy ones.
.
Additionally, I barley add any time to my total when creating levels as it uses a piece of software outside of visual studio.
.
My character text box is pretty much a recreation of the ones seen in undertale, even using the voice blip of toriel as a place holder.
.
This should allow me to add a small story that I will make sure to keep simple, like a mario esque plot.
.
The re-align function was fixed by using the variable rotation direction, then setting that to 1 or -1 depending on contact with reverse direction ability or not
.
Then multiplying rot_speed by that value reverse the direction that re-align moves.
.
I will have to knuckle down on level design tomorrow and make sure each level introduces the abilities and tiles one at a time, letting the player get used to them, allowing for levels that include a mix of multiple to be more approachable.
Dev Log #23
.
Very good day today, embracing the foddian likeness of my game, making sure that the player gets as angry as possible, just to make that feeling of victory feel so sweet.
.
Here’s what I did today:
LOSER document created (must be filled in to reveal hints, which will be added later)
Change rotation direction ability
New map (Still a WIP)
Document uses follow mouse function and draw line function. Starting the line at the mouses previous position and ending it at its new position.
.
This happens very fast, so the lines do not appear blocky and appear like real pencil drawing.
.
The change rotation ability uses the pbject layer like my previous time stop ability, and now that I understand how object layers work, i was easily able to make this ability by copying my clock abiltiy load and changing the result of contact.
.
The result being making rotation speed negative, reversing direction of rotation.
.
The new map uses a mix of many abilities and objects, but I have not added them in just yet.
.
I could quite easily I feel but I’ve reached my 3 hour brain capacity limit, because realisticly with the time spent making pngs, finding sounds, reading pygame documentation and waching tutorials, I’ve probably spent about 5.
.
But rewards are not for the weak or the lazy, and this little project of mine is helping me leaps and bounds for my future A-level comp sci journey.
.
See you next time, with some jucy new progress!!!!
Dev log #22
.
Back to business!!
.
Today I added:
Uncompleted level select lockout
Separated tile load into own file
Easter egg room added
Level lockout works by calculating max_player_level, the furthest level a player can select based on if they have beat the previous levels.
.
This works buy using a function to check if current player_level is greater than max_player_level, if it is then max_player_level = player level.
.
Then for level select button with number greater than max_player_level, a red cross is screen.blited ontop,as well as not allowing mouse clicks of the rect from having any function.
.
Tile file separation helped me remove 150 lines from my main file, improving readability.
.
My easter egg has a 2% chance of happening and gives the player a custom gun appearance on discovery.
.
The code used to change the guns appearenece should let me, in future, make custom skins for the gun, skins that could be rewarded for levels complete, secondary level goals reached, ect…
.
I will not share how to reach my secret room, but I think it would be better for someone to stumble across it by accident.
.
Good day today, progress is picking up pace again, good job me!!!
.
Strange, it seems, there is a man here….
Dev Log #21
.
Getting lazy now, saw hacktime was down and decided not to bother doing anything before 12, but I hope I will break this cycle.
.
Today I added working buttons that when pressed, remove gate blocking path.
.
Had to over hall all my tile loading and map loading and parts of my collision resolution to allow me to reduce the lag being caused in some levels and be able to remove collision selectively for tile types.
.
I learn how to use set today. I used a set to store the types of gates that have been opened because it prevents duplicates and allows me to quickly check whether a specific gate is open.
.
No animations for button presses yet as I want to leave that stuff for the end.
.
I’m feeling the time crunch now because I really want this to be finished before I get back to school and focus on my studies, but this still counts as practice so I’ll continue a little bit during school days.
.
I will do better tomorrow I promise, cause I’ve got this far, it would be a waste to stop now.
Dev Log #20
.
Sorry for the hiatus, not a lot done, but sure I will be soaring tomorrow.
.
Today I addded:
Killable enemies
New reset all function
Killable enemies act as win conditions, similar to the mini stars, having to all be killed for the goal polygon to spawn.
.
The reset function made my code much more readable and allowed me to condense all of the restart events like lose velocity, set position here, screen.blit things again if needed.
.
I started working on 3 buttons that when pressed, open a gate but didn’t get to finishing it sadly.
.
I want each button to have different press conditions, one can be pressed by bullets only, one only on direct gun contact and the other working with either or.
.
In later stages, I will have to think how i will communicate this functionality to the player but I’m saving texturing and making the game look good for last.
.
Hope to have more progress tomorrow. Fingers crossed.
Dev Log #19
.
Getting lazy, need to lock in and get 3 hours tomorrow.
.
Today I added:
Working portals
Time stop ability
Portals and time stop ability use object layers in tiles, a much easier solution compared to my use of polygons for complete goals, may change that but not sure.
.
Time stop ability is pretty simple, works like pause menu, but allows image rotation and enables follow mouse.
.
Portals work by on contact, moving player position centre to other portal centre.
.
The velocity changes with the exit direction using the following code:
rotation_difference = entry_angle - exit_angle
self.velocity.rotate_ip(rotation_difference)
Overall, ok day, not sure what I’ll do tmr, but I’m sure theres something hiding on my checklist.
.
ALSO!!, Fix this horrible performance issue I had, see bellow for comparison
Dev Log #18
.
Good day, but stopped early today beacuse, well, i’m afraid…
.
What I did today:
Added mini_stars
Added re-align option when grounded
Added new map
Mini stars are to be collected first, unlocking the finish goal. They are hard coded right now so cant be moved for new levels, but I can change that if need be.
.
Re-align was initially supposed to allow A to rotate the player one direction and D the other, but my game seemed to really not like decreasing the angle value when grounded.
.
So I’ve made it so rotation only happens one direction, but a full 360 range of motion is possible.
.
The new map that uses portals, but the portals are not actually functional yet so, thats a job for tomorrow .
.
Almost everything added from last devlogs check list, but decided against adding placeholder music during playing state as i think I would go insane from listening to it on loop, so that can wait till the end.
.
Hope to have a longer more prosperous dev log next time, see you then!!!
Dev Log #17
.
Feel kinda stuck in-between, but once a pass my last hurdle, all of my efforts will be focused on new abilities, new tiles and art, but the basics are sooo close to being complete.
.
Today i did the following:
Level stopwatch
Level complete goal changed
Edited map
Complete goal had to be changed to make animation of win goal possible, like coin pick up in Mario. Uses polygon collision, freezes on contact currently but working on fix.
.
Level stopwatch works well, and works with pause menu by subtracting time passed in pause menu from counter total on continue button pressed.
.
Map needed editing as I feel my game is too hard and my muscle memory from 100’s of tries makes it feel easy, but really isn’t.
.
Tried making a new map that requires you to collect many little stars to reveal the goal but found it hard to find a map that works with wide range of movement.
.
This issue is caused by gun being useless most of the time on collision with floor as it is aimed the wrong way.
.
I plan to have the player be able to rotate the gun while its grounded using A or D, this re-ajusting stopping players getting stuck. That or a jump ability.
.
Next devlog hope to have:
Mini stars working
New map
Rotate/jump when grounded
Game in progress music
See you next devlog, no 1 day hiatus next time (;
Dev Log #16
.
Today was good. I was welmed.
.
I did the following today:
Added working kill tile
Fixed image lagging behind player polygon
Switched over to match cases
Kill tile works as intended, but doen’t ‘kill’ the player yet, it just freezes everything, plays a sound and propts you to restart.
.
Image lagging behind was a big issue, causing the kill tile to look as if it were killing without contact, but this was cause by the image lag behind.
.
I tried changing the order of functions in update() but that didn’t work, tried other stuff like changing how some functions work, in the end, it was because i called update after player_group.draw(). Silly me!!
.
Match case switch over was easy, just the indentation was at times a pain, but I’ve sorted it now, thank goodness!
.
Going to try and finish the loss screen that appears, adding a level select button and a return to start, but might not as its not strictly necessary, but does look nice.
.
Not sure what other stuff to add, maybe a new level?
.
Who knows, see you next Dev Log!!!!
#Dev Log 15
.
Good day at the office.
.
Did the following today:
Working level select
Fixed Music Issue
Fixed map loading issues (didn’t discover until today)
Added tile classes to replace gid based system for tile specific collision
My issues today were caused by my moving of code into separate files, but I’m getting there. I’m no longer using from ___ import * and I am instead using import ______.
.
The sound issue was caused by a variable in settings setting play music to False without my knowledge.
.
Map loading broke because my maps are only loaded once outside of the while loop, so I fixed that.
.
Tiles now have a class that can be checked, allowing for different interactions with tiles dependent on tile class.
.
Thinking about storing some of my variables into match statements for readability but I find using match cases in Settings.py to be really difficult so I will proceed with caution and immense fear!!!
.
Not sure what tomorrow holds, thinking about making the kill and win tiles do something rather than print win or killed, but might be held up by this switch from many elifs to match cases.
.
Staying determined, see you next dev log.
.
PS, a little hint to my little easter egg 📂︎🖮︎
#Dev Log 14
.
Ying ang Yang session today:
.
I did the following:
2 new maps - one I’m keeping a secret for the complete game >;]
Level select rect load (not working YET)
Kill tile (detection only)
Separating code into files outside of main
Music Broke….
Level select menu was a perfect mix of challenge and enjoyability.
.
I loaded the squares in this even patter by creating a rect at (360, 260), then after the first rectangle is created, add 120 to the x value, until x >= 960.
.
Then I added 120 to y to create a new line and set x back to 360.
.
The kill tile collision was done the same way as the win tile collision, using tile ID’s.
.
The only issue I’ve come across is the music suddenyl not working after moving it into its own seperate file, despite it working like an hour before.
.
I’ve left this issue for tomorrow as I’ve already got a lot of hours under my belt today.
.
Also the new level is not possible despite all my effort so will have to change that also.
.
Good progress today, I’ve made a lit of all I want to achieve in Barrel Roll Bullet before the dedline and one by one, I’m checking that list of.
.
See you next devlog. Maybe then I’ll reveal the space in-between 💣︎♋︎■︎📬︎□︎♑︎♑︎
Dev Log #13.Unlucky for some, but not for me!
.
Collision resolution finally working!!!!
.
Here’s how it works:
.
SAT algorithm returns the axis with the smallest overlap (this is the shortest distance to separate the player and the tile).
.
Correct normal line direction so that it points from the tile to the player.
.
Move player across MTV (Minimum Translation Vector), pushing player out of the tile. Note: MTV is calculated by choosing the smallest overlap in the direction that moves the two shapes apart.
.
Remove velocity that is parallel to the collision surface, allowing the object to glide across it without getting stuck.
.
That’s the jist of it. There are some other things I didn’t include, like how only polygons are made for tiles touching the player’s polygon/rect, but I discussed this in a past dev log.
.
In all honesty, I don’t fully understand the maths behind it, but I was still able to make my own SAT collision system, so I obviously know enough.
.
Also added some smaller things like a bullet limit and a restart caused by holding the R button down.
.
This is good progress and should allow me to add more easily things like level select, new Tiled maps, new tile variants that cause different effects, etc.
.
Next dev log is going to be packed with stuff!!!!.See you then (;
#Dev Log 12
.
Good honest session today.
.
Changed my collision resolution as it seemed to be causing me alot of trouble and hurting preformance.
.
Now using polygon collision detection instead of mask collision as it greatly improves preformance and simplicty of colllision resolution.
.
Although that is still not perfect.
.
I had it working quite well to a point but once I tried to prevent wall riding through on ground variables set to True or False, everyhting seemed to go wibledy wobeldy from there.
.
My collision detection works as follow:
Dev Log #11
.
Not Good. Very NOT Good.
.
What I achieved today
Victory tile added
Aiming reticle completely destroyed
Fixed aiming reticle
Mask detection not working as intended
Gun no longer stopping rotation on collision
complete loss of sanity
OK, fun. How did this all happen?
.
My aiming reticle misangling issue was caused by setting initial rotation angle to 15. I did this to increse rotation speed.
.
The issue being this caused my gun image to also be rotated 15 degrees, causing the barrel not to point to my mouse.
.
I solved the issue by making initial rotation angle to 0, only += it to = 15 once first shot had been fired.
.
The next issue I have yet to solve is collision resolution.
.
It had been an underlying issue for some time, and i still don’t yet know how to fix it. But in my attempt to fix it, I then broke my stop_rotation function, meaning rotation now continues despite collision.
.
Hope to fix these issues by next devlog, then also give my recoil a bit of calibrating as each bullet seems to be weaker than the last, i think this is caused by my collision resolution setting velocity to 0.
.
Next devlog will hopefully be more fruitful!
Dev log #10
.
DOUBLE DIGITS!!
.
What I did today:
Added a working pause menu
Fixed start screen size
Spruced up mask collisions
An issue im having with my new and improved collision sytem is that when i reduce player velocity on collision, as well as rotation speed, my player comes to a hault.
.
In real life, as im sure many of you know, a gun isnt likely to ballance on the barrel verticly, its handle will fall due to being heavier.
.
I do not yet know how to combat this issue, but I have brain stormed some ideas.
.
I was going to try and find a center of mass, but that wouldn’t work because that would cause my barrel to float at times due to being disproportionally lighter compared to the gun grip, meaning when gravity acted on it, it would be lob sided.
.
My other idea was to break the gun into 3 rectangles, barrel, handel and inbetween, then give these rectangles set weights. But i was unable to implement that.
.
I’m going to try some other solutions, but i think this is going to be some of my toughest challenges yet!
.
Still undesided on the goals for next devlog, we will see what my brain decided that faithfull day.
Dev Log #9
.
Not the best keyboard clacking session, but not the worst. Looking at you Dev Log #4 >:[
.
Today I added pixel perfect collision.
.
First I got the players mask and a list of the rectangle tiles touching my player rectangle. I then listed these rectangles and was able to detect collision based on if they made contact with the players mask.
.
The next step was collision resolution.
.
After a detected collision, the location of collision is then increase the y co-ordinate of the player mask, effectivly keeping the player above the ground. This is how collision resolution works for all the other directions, just with varying positions.
.
With this I then attempted to add a feature that stopped rotation as a surface was hit, to prevent a constanly spinning gun that sits on the floor.
.
This is still a WIP, but I have been able to make the gun stop all movement once on contact on a wall, but this is unrealistic as in real life if an object makes contact with a wall it does not loose all its momentum.
.
I will try to combat this isse by adding a bounce effect that gradually reduces momentum on wall contact, rather than causing it to loose all of it.
.
Next devlog I hope to have a working wall bounce system and maybe a finish goal that, when entered, plays a victory noise and victory screen.
.
Holding out hope for the future!!
Dev Log #8
.
I new it was too good to be true, progress has slowed yet again. ):
.
Today I added:
‘Working’ collisions
While my collisions ‘work’, they only work when my player rectangle is unchanged.
.
The issue being when my gun rotates, its rectangle changes size.
.
This change of size is interpreted as a movement by my collision sytem, therefore once I come in contact with a tile, the bottom of the rectangle slowly becomes bigger and smaller.
.
this caused it to move to the tops of different tiles, eventually causing it to be flung out of the game window at rapid speed.
.
I plan to combat this issue with either of these methods:
.
OPTION A: Pixel perfect collision done through player masks.
.
This option is harder and can effect preformance if not implemented properly, but with give a smooth and finished collision effect
.
OPTION B: Set hitbox collision
.
This option creates a set region on the player, only that region (probably a rectangle shape to make collision detection easy) being able to collide with tiles.
.
This option will likely be easier, but will look less pollished as the gun barrel would not fall due to gravity, it would stay above the ground while the grip sits on the ground.
.
My goals for next dev-log are unclear, but for now I hope to have a working collision system at least!!!
Dev Log #7
.
Another prosperous coding session today!
.
I have added the following features:
Correct bullet orientation
Sound effects
Tiled surface (no collisions)
I also had to change the screen size as its height and length needed to be divisible by 16 in order for my tiles to be used easily.
.
I added the pytmx python library to allow me to use Tiled, a software that makes level creation very simple and quickly repeatable.
.
It should significantly increase my workflow speed when I get far enough in development to actually be making levels.
.
I also did some fine tuning on the strength of recoil, making it stronger but controllable.
.
Additionally, I increased the speed at which the gun rotates in air to make aiming more difficult but still manageable.
.
Overall, 7/10 work day today.
.
By next devlog I hope to have some of the following complete:
Working collision
Finish goal that takes you to the next level
Possible moving colidable tile
Bullet limit and UI to show this
I’m back in business now, regained most of the knowledge I lost from my 1 week hiatus. Wishing future me luck for the next devlog!
.
And all you others out there as well. STAY DETERMINED!!!!!
Dev Log #6
.
I have made some absolute serious progress!!
.
I have added:
.
Working recoil
In-air gun rotation
Aiming phase and playing phase (turning aiming guide on and off)
Dotted aiming guide
This has by far been my best coding session as of late and had little to no complications…
.
Well there was one… Where my entire recoil system was built on mouse position, a mouse which only controls the direction of the bullet once and never again per level.
.
So that caused me some grief. But I was able to calculate recoil based on the bullet’s movement rather than the mouse’s position.
.
A bullet which would spawn and move forward from the barrel despite orientation, solving my problem and making the rest of the other features added much simpler to implement.
.
In the next few dev logs I hope to have added the following:
.
Make bullet orientation match barrel orientation
Add a start menu soundtrack
Bullet trail
Sound effects (e.g. gunshot, start button pressed)
Complete level (with collisions)
I hope progress continues at the rate it is, because if so, I will be drowning in stardust.
Dev Log #5
.
I have redeemed myself 10 fold. I have finally added recoil to my game!!!!
.
This moment shows real progress. I have been trying to implement recoil for a while now, and I have finally done it.
.
I did this by using the velocity I calculated to determine what direction and what speed bullets are shot at from the gun:
def __init__(self, barrel_pos, m_pos):
super().__init__()
self.image = pygame.image.load("Images/BULLET.png").convert_alpha()
self.rect = self.image.get_rect(center=barrel_pos)
direction = pygame.Vector2(
m_pos[0] - barrel_pos[0],
m_pos[1] - barrel_pos[1]
)
if direction.length() > 0:
direction = direction.normalize()
self.velocity = direction * 10
Passing the velocity into my player group and subtracting it from the player’s centre, effectively creating movement opposite to the direction of the bullets, aka recoil!!!
def recoil(self, velocity):
self.recoiled = velocity
self.rect.x -= (self.recoiled.x * 10)
self.rect.y -= (self.recoiled.y * 10)
I also made it so that bullets despawn once off-screen, optimising performance.
.
Finally, I re-ordered my code, making debugging and overall readability much easier.
.
While my recoil is not fully complete, this is a large step in the right direction.
.
I hope by the next devlog I have a fully working recoil system and possibly a working level. Who knows!
.
Aim for the stars and you’ll at least reach the moon.
Dev Log Number 4
.
With the amount of time logged, you would think a lot has been achieved. But no…
.
After an almost 2 week long holiday induced hiatus, it seemed I had lost my confidence with pygame, and at some points, felt like i had lost my brain entirely.
.
My attempt to add shootable bullets should have been a simple task, yet it seemed to be impossible. And its not like I could have packed up shop and tried something else, a shootable bullet is esential for a game where the only playable charcater is, well, A GUN!
.
The first challenge was getting the bullet to spawn from the correct location. Initially, the bullets appeared from the centre of the gun rather than the barrel. Obviously that was not the intent.
.
I eventually solved the issue (casued by my own ignorance) and passed the barrel position calculated previously into my bullet class rather than re-calculating this (why would i do this, what on earth was I thinking 😩)
.
With that issue conquered, i then had to do the maths required to shoot a bullet from the barrel to the position of the mouse. Easy enough. NOT.
.
To cut a long story short, I used the code attatched to finally make my gun work.
.
My shootable bullets are far from perfect, they sometimes don’t shoot at all even when the mouse is pressed, their orientation does not match the direction the gun is facing and they are far too small.
.
I plan to fix this by: killing bullets as they go offscreen, adding some sort of rotation to the bullets and for the bullets not being shot when intended, i have no real plan on how I’m going to fix that.
.
I hope I come back to you in the next dev log with some actually real progress, because this is a sad excuse.
.
But with determination and grit and endless scrolling of the pygame documentation, I am sure progress will come as fast as a speeding train [or some sort of blue mammal with quills (^_~)]
Dev log #3
.
Today I got a bit sidetracked and decided to move all of my code within a sprite class to reduce clutter. As a newbie, this was my greatest challenge (besides my arch enemy recoil physics).
.
This process was tedious and caused my entire code to break completely on multiple occasions. But the risk and complication was worth the reward. I reduced my codes line count by 15.
.
Due to the length of this process, very little was added. However, I did manage to add a aiming reticle for your first initial shot of the gun.
.
As seen in the images below, this feature came with its own plethora of annoyances. Annoyances such as multiplying rapidly and staying fixed on the gun trigger rather than the barrel.
.
I also created a new gun sprite that now faced the mouse correctly.
.
In the next dev log, I hope I come bearing more features.
.
I plan to add:
.Basic bullet firing
.Dotted aiming line instead of solid
.Player start game (in which gravity will be applied)
.NOT recoil, sadly that will have to wait
.
Went back to my roots today and used my beginner tutorial to help me learn how to apply the sprite class, video linked here: https://youtu.be/AY9MnQ4x3zk?si=9UtUnmyWYpsHZ6d5
.
While the sprite class has acted as a roadblock to speed of development, I believe that by the next devlog, my progress will be sure to amaze (I say with confidence 🤞)
.
Now with the basics ingrained in my head, my game is beginning to take shape. While I wasn’t able to add the recoil mechanics I had hoped for, I was able to:
.Create a functioning start screen.
.Make my player sprite follow the mouse direction.
.
Today I used a different tutorial to assist me, linked here: https://youtu.be/WnIycS9Gf_c?si=UhNQQ8ekJLdPhRZO
.
While these are small achievements, they will help build a much greater finished product. Thanks to implementing these new features, I now understand the importance of game states and how to apply them, as well as how to track mouse movement and mouse input.
.
The reason I implemented sprite rotation based on mouse direction was to allow the player to aim their initial shot and determine their trajectory.
.
Later, the player will have to use well-timed shots to control their direction rather than relying on this simpler aiming system, making my game’s movement feel more unique and rewarding fast reaction times.
.
By the next dev log, I hope to create a new gun sprite that follows the mouse correctly, make a shootable bullet, and finally implement the recoil effect when the gun is fired, although this still seems to be my biggest hurdle.
.
Progress is picking up pace. Every new feature is another lesson learned, helping build the foundations of what I hope will become my magnum opus. See you in the next dev log. ;)
Dev Log #1 – Grasping the Basics of Pygame
.
Since I’m new to Pygame, my first goal has been learning the fundamentals and applying them to build the foundations of my game.
.
So far I’ve implemented:
.
.Basic gravity
.Collision detection with the floor
.Upward player movement using mouse input
.Loading and displaying sprites and backgrounds
.
Building these simple features helped me understand how the game loop works, how collision is detected using rectangles, and how offsetting the player’s y-coordinate can be used to create gravity.
.
At the moment, the player is represented with a placeholder sprite, as my focus is on the code behind my game (and art has never been my strong suit).
.
I’ve been using the following tutorial, a learning resource that has helped me greatly:
.
https://youtu.be/AY9MnQ4x3zk?si=x9KrrOI12N1CwT29
.
Now that I have an understanding of the basics, I’m going to start moving towards creating the mechanics required for the actual game.
.
My goal before the next dev log is to have a basic title screen completed and, if possible, implement the recoil mechanic for my player.
.
Progress is slow at the moment, but every feature I build teaches me something new. Hopefully, the next update will be bigger and come together more quickly (as long as all goes well 🤞).