I found a some nice base sprites from this video and I added them to my sprite list. I will try to follow this video for some basic core mechanics then I will go from there when trying to create something else.
I started by downloading the assets in the tutorial and they look like this:
I think it looks pretty clean for what I need for now. There's no rush on the art right now just focusing on the core gameplay.
I decided to scrap what I did yesterday as this tutorial has a different and better approach towards it.
I started coding and trying to follow along in the video and I learned a lot of stuff.
The player movement was pretty basic. If it receives a certain input from the keyboard, the player will start moving in a certain direction. I made these keys wasd, and the arrow keys. So for example if I press "A" or the left arrow key, the players location on the xaxis or horizontal axis(hspd) will be subtracted every frame by the current variable speed.
Now the harder part to figure out was the collision with the wall. How it is explained in the video is that your speed is the current amount of pixels you move each frame. If your speed is 5 and you are moving towards the wall, as soon as the distance between the wall and the player is less than 5 pixels, it will slow it down to a speed of 0 and then the while loop will start. The while loop pretty much says that while I'm less than 5 pixels from the wall and not 1 pixel from the wall, keep moving towards the wall by one pixel until you are one pixel away from the wall then it stops.
So I got this and it makes sense and it made me realize the potential of whats possible through programming.
Here are some pictures of my code and scripts.



Tomorrow I plan on trying out if it works and maybe adding some sprites.
ahh
ReplyDelete