How To Make A Side Scrolling Game In Java
You might find it easier to implement your X and Y position definitions in your paintComponent() method instead of abstracting the process to other methods and passing a Player object every time. How To Shrink A Default Install Lvm Pvresize Shrink on this page. Try defining constants for your viewport dimensions (VIEWPORT_WIDTH, VIEWPORT_HEIGHT, etc). In your paintComponent() method, reference these in conjunction with your player's coordinates to position your character on the screen.
Oct 5, 2013 - 7 min - Uploaded by Andrew MacRaeThis is a small, and simple 2D side scrolling game that I'm attempting to make in Java.
So basically, I had a few free minutes so I decided to put this together - you might want to look through the code, modify it and make it into your own game!:) If you do, comment on this project with the link and I'll check it out:P It shouldn't be too hard to understand my code (which you could probably make more efficient), as I've commented a lot of it (for once:L). This is a very basic sidescroller, with 2 enemies, and only left/right sidescrolling. Future updates: - Jumping when 'space' is pressed. - Using tiles as a real ground (instead of purely decorative) - actors will not be able to move through them. - Moving enemies (they want to kill you:p). - Better images for the player & enemies (I didn't have the time to source some images). - Backgrounds.