Spaceship Game
- 15 Devlogs
- 44 Total hours
I have done a lot since my last log. Most of my time was spent adding cracks to the asteroids depending on their health, this part was unreasonably hard. You would think it is as simple as adding lines from random points on the circumference to the centre, no. I had to have three different kinds of lines, create segments of each full crack using 2 or 3 kinds of lines, then only draw them depending on the health. Ok it does not sound as hard as it was, it took ages to get a good enough look. I then changed the ship movement so there is now a thrust and brake upgrade in ship upgrades. I also just added a pause feature while playing to exit back to the menu or just pause it I guess. Thats it for now gotta think of more ideas to add
I hate AI. I had decided to draw a background using polygons and lines, (very bad idea). I got a general layout done with about 100 lines of code and most of which was just variables of coordinates. Its get very confusing very quick. So I decided why not just give el gpt all of these coordinates and lines and get it to join them into one big polygon to simplify the code. AI sucks, I think I spent about 5 hours just typing prompts to get it to understand (it never did). So I decided to make the polygon myself and just get it to calculate coordinates, it could do them one at a time very easily, but any more and it would make points up. Desmos came to the rescue for intersection points. Other than those polygons I made the stars look better, added turn speed upgrade, made asteroids slower. I still need to finish the home screen and do the others.
I have not been very consistant with coding recently so not much has been done. I started drawing the buttons in the level select screen with a for loop instead of individually. Got a new colour palette ready and some new fonts but have not yet decided on what I should use each colour and font on so the UI look terrible right now. What I spent most of the time on was make stars in the background. I spawn 200 stars randomly across the screen with a random depth as well(makes it look cool), I then calculate the speed using the depth as well and in the future I will make the stars twinkle so size and brightness will depend on depth. The stars look 3d when they move and I also make them move in the opposite direction to the ship when playing to make the ship look like its actually moving. I might change how the ship moves in the future. Sorry for typing so much I wasn’t bothered to think about what I was writing beforehand.
I haven’t coded in like a week so I dont remember what changed but I know I made the buy buttons in garage no longer all say max once I max one out.
I changed how the asteroids spawn on the screen. It used to be they just spawn in a random place with a random angle and random speed (all with relevant parameters). Now they spawn at a set x but still the same random y, speed and angle and they spawn one at a time with intervals that change depending on the level. This did make the levels easier so I will be adding harder ones in the future
Well something happened with my last devlog and it just didn’t post it seems so this one covers me fixing the UI in garage and adding a new upgrade; fireRate. I change the way you shoot lasers. It is no longer click to shoot, you have to hold space and there is an interval between laser shots that gets reduced when you shoot. I was right though with the garage, I made zero changes to garage to make the new upgrade. Also finally added a way to get infinite money to make it easier for me to test.
Ok I was wrong the rest has not been “more relaxing”. I knew I would have to optimise the code in garage but I didn’t know it would take so much effort. I combined the three upgrade states into one function that uses the screen name as the key to each section of the library to get the needed information. I also spent ages on a for loop to make blocks for each upgrade so adding them should be easier. The event handle function also works for every upgrade no more piles of if statements. Now I will be focusing on fixing the UI and adding upgrades.
Upgrades finally work now so the rest should be more relaxing. I had to change all my vars into dictionaries so I could use them in the garage file without any circles. I then just added them into the handle events in a load of if statements which may not be the most optimal but I am lazy. Finally beat level 3 with max upgrades. Getting harder to test now so I might have to do something about that.
Spent absolutely forever making the garage look better and made it capable to be updated with more upgrades. As of now I have the code sorted in garage and I like the design but it needs a lot of work still.
Made buttons look cooler by fixing the colouring and making them slightly smaller when mouse is hovering over. Added a coins system that adds either 100, 200 or 500 for beating level 1, 2 or 3 and a fifth for losing. Still need to add some upgrades and make the game just look better
Ok I did what I said I was too lazy to do, I put each screen into its own file in a different folder inside the main one. Basically just copied the new functions I made over and I changed the way a new state is called slightly. now main looks very clean I got rid of a lot of functions just to write them again because I got confused. Turns out I didn’t need a whole function. Game finally works again now and hopefully I can just start adding features now.
I have finally fixed all the functions and the layout of the code, game more or less works, need to finalise levels, update screens, and add more to the garage(upgrades). But I am now thinking cause the game is getting much bigger I could have different files for each screen, I probably should do that but I am too lazy.
Fixed collision with the laser and asteroid so it detects the full laser polygon. I then realised I need to completely change the layout of my game again. So I deleted the whole running loop and put in what the layout should be. Now I am in the process of getting all the functions right which will take a while.
the asteroids movement is better now I think, they move left to right with an allowance of 40 degrees up or down. Asteroids can now be shot by laser but only if the back coordinates intersect with the circles of the asteroids. Text displays the level, health and number of asteroids left now.
Ok so I have been very busy with stardance problems so I was just coding when I could. I didn’t want to make a devlog till I had the general game started. I will be working on this game for quite some time and will keep improving the game. So far I have made a spaceship class and a spaceship that can fly and speeds up to a maximum speed and bounces of the walls. I have another asteroid class, there is an x amount of asteroids that fly around the screen from left to right and take 10 health away from the players 100 until they die. I am working on the asteroids getting destroyed now. I made the ship shoot lasers when you press space yesterday, this part probably took the longest cause I’m stupid.