- Have been trying to figure out why I'm getting an attribute error for an hour and 30 minutes now. None of my solutions have worked. I have eliminated the possibility that it has to do with the abstract class, that it's because the super classes have update methods too, and that it's because update is called higher in the code than the instantiation of the player object. Have also checked all indents (they're all spaces) and tested with them as tabs as well, as Google suggested it could be an indentation error.
- The error was finally fixed when I changed self.vx to self.sprite.vx. This would suggest to me that the self.sprite references are actually referring to the sprite in the drawable class and not the one in the player class. I'm still not sure why it wouldn't work without the .sprite part.
- Managed to fix errors with attributes, now running into error where sprite renderer takes an int instead of a float. However, the value for time is so small that converting it to an int simply returns 0, and the player doesn't move.
- When I take out world.process (the thing that has the float/int error) and simply print the position the sprite should be at, it appears correctly, however there's obviously no sprite moving since it's not being rendered.
- Ended up getting confused about NDC again.
- Worked for 4 hours today.
Work for Wednesday 5/31
Work for Tuesday 5/30
- Plan for week includes getting movement working correctly based on time rather than moving a set distance per step and implementing shooting. I don't know how long this will take so that's all I'll plan for for now.
- Need to add update function to drawable, making drawable abstract, and need to move the movement updates from the movement class into this update function.
- Have moved all of the functions from movement into the Player class, however, still unsure when update needs to be called.
Work for Friday 2/26
- Still trying to get command line arguments to work- figured out how to input them in Pycharm but now getting a type error with the window creation method in sdl2
- Fixed error by casting inputs to int- change arguments by going to run -> edit configuration -> script parameters
- Not sure if we want the height and width to maintain the same aspect ratio so it's still a tall rectangular/square/etc window like arcade console screens usually are. Changing the width but not the height, at the moment, gives a very large, wide spaceship, which will probably look weird once there are actual sprites in there and not just a white square.
- I can either change it so that the width of the spaceship doesn't scale, or so that the user only enters height or width and the other scales
- Total time: 2 hours
- Total time for week: 12.5 hours
Work for Thursday 5/25
- Working on creating class that will draw sprites for enemies and players.
- Need to create separate window class that has getHeight and getWidth methods and returns the window so that it can be used in the main method
- Look up command line arguments so that I can add parameters to main and then create the window width and height on the fly
- Can then store these as variables in main method and use when creating player
- Instead of running in positions to create a player, should run in how far along the screen it should be located (.5, etc) and have drawable do that
- Window class not working at the moment- has issue with the type of variable being used.
- Ended up removing window class entirely and just passing height and width in as parameters when the player is drawn. This should still allow for command line input, since I set them as local variables in the main method.
- Now have an issue with the player no longer moving.
- All issues have been resolved with the draw class and the player moves correctly again.
- Attempted to get command line arguments working, but when running in terminal apparently invalid syntax exists in main.py that's not present when I look at the file in Pycharm. Will look into it more tomorrow (using giant book)
- Total time: 2.5 hours
Work for Wednesday 5/24
- Multiple python files: import _filename_ as _name_, to use in program -> name.classname()
- Github/Clubhouse integration:
- Can add event handler, which will move a story to "ready for review" automatically when I open a pull request- I can't do this without being an administrator.
- After a pull request is made, add [ch###] where ### is the story number in a new comment to associate them
- Making temporary player sprite:
- Locations: x = 0 -> far left, y = 0 -> top
- White rectangle was added as temporary player sprite and is positioned in the middle of the bottom of the screen. I didn't hardcode in the width/height/position, but instead used the width and height variables I had made for the screen itself.
- These are hardcoded, because I have yet to figure out normalized coordinates, so I will change them once I figure that out. It shouldn't affect the player sprite as long as I am only changing the width and height variables in the code.
- Opened pull request with a player class (not much in it right now) and changes to the code to create the player sprite correctly. Also added variables for width, height, etc. instead of having them hardcoded into the method parameters like I had previously.
- All of this took around 2 hours.
- Notes while working on movement:
- Maybe to create unlimited number of players, create "makeplayer" method that includes sprite and player creation, and add players to an array or something.
- Run player array/data structure into runloop, and then run for player in players -> getinput for each.
- Created movement- only with keyboard arrow keys for now, uses getInput method in player class
- Will add pull request for player movement update once player class update is merged- unable to push new changes without the file being merged.
- Took around 2 hours.
Work for Monday 5/22 and Tuesday 5/23
Monday:
- Completed task Review the Summer Mission
- Completed task Create Dev Diary- this blog will act as the dev diary
Total time: 1 hour
Tuesday:
- Completed task Learn About Agile Software Planning - 1 hour.
- Semi-completed task to connect Github and Clubhouse
- I know how to do it, but don't have the access required on the Git repository (access to repository settings).
- Can either do it on my forked version of the code or the main goducks version- not sure which is better.
- Code Review:
- I create a branch before editing anything.
- When I want to make a change to the code, I open a pull request, which shows the differences between my branch of the code and the master code.
- I can then push more commits from my branch to add them to my pull request, where they can be reviewed and commented on.
- I can also request reviews on my pull request by adding users to the review.
- Once all commits are approved, merge pull request to base branch.
- (Hopefully) fixed merging/pulling issue in Github by being added as collaborator, so (minimal) work completed over winter break is now in main.py
- Pycharm:
- Work on forked version (or figure out how to make branch on goducks version) of file.
- When change is made, commit and push.
- Create pull request in VCS menu (only do once)
- Until pull request is merged, can continue to push commits to request.
- Figuring out Github took 2 hours.
- Created list of software tasks to complete, in relative order:
- Create temporary (white square) ships for one player
- Apply movement to ship based on player input- arrow keys
- Add ability for ship to shoot on button press- spacebar
- Create temporary sprites for aliens
- Apply automatic movement to aliens
- Create health system for aliens so they can be destroyed
- Create point system for player ship
- Add game over condition for player
- Add second player functionality
- Add nicer-looking permanent sprites
- This task and reviewing SDL took 2 hours.
Total time: 5 hours
Subscribe to:
Posts (Atom)
