To recap. I left the last blog with an inclusion of simple keyboard controls, collision between the player and the enemies. What I worked on straight after that blog post were the controls. What I currently have in place is something I hope will work wonderfully with a touchscreen. You swipe to go up and down and the faster you swipe the further the player goes up and down the screen. It would be an extremely simple thing to implement but getting your head around Y starting from the top at 0 and increasing as you go down made it a bit confusing to code.
Old version of the player.cs code. One that works...
I managed to get something working though which was slightly needlessly complicated and has a minor bug. Stuff like making sure the player stays inside the viewport is super easy. If the player is going to or already has (depending on how you want it to work) went outside the Y through the top then move them to the highest point but no higher.
My move after that was to sleep and think about new objectives. What I came up with after that was showing the current player health. The initial blocks that represent health work fine but I don't know how to remove them yet.
No enemies, no player movement, no real fun and no real graphics!
One thing that I added and I managed to get working fine were the backgrounds. They work perfectly so far. I have two sprites that loop over the screen. On top of that I have a smaller sprite on the background looping. It's simple stuff but I remember it causing problems in ThreeThingGame for the one half of our programming team that eventually dropped out.
Finally, I wanted to create an air, surface and underwater enemy classes. That's simple, you just make them but I wanted a purpose behind them. I wanted the update code from the game class to work in it. This created problems. I've managed to solve all compiler errors, it compiles! The problem is A: it doesn't draw any enemies and B: it doesn't allow the player to move. The player bug was caused by me changing some things in the player class too. These bugs are tied down to classes interacting with eachother mainly. This is the learning as I go part. To give myself some credit I have learn a lot of things now and that learning experience is what gives me the joy of making this. It's why I like programming.
I might spend the rest of the day learning more by asking questions and watching tutorials. I'm finding it hard to concentrate with the tutorials though. I think I'm spoiled by the interaction lectures and working with colleagues offers. The deadline nears and stress is getting high. This thing means a lot to me.
No comments:
Post a Comment