Java Game Development #17 – Animations

[ad_1]
Complete Java Game Development Course now available at my website

In this video we learn how to add animations into our java game. If you have any questions then be sure to leave a comment or contact me on twitter; realtutsgml. If you learned something then be sure to leave a like, comment, and favorite.

Animation Link –

Outro Song:
Name: Spitfire (Kill the Noise Remix)
Artist: Porter Robinson
Youtube channel: /user/PorterRobinsonMusic
Website:
Facebook:

Have you ever wanted to create games? Have you ever gotten fed up with it being to difficult? Well now is the time to thank me and possibly subscribe because you have just found the channel for you! Game Maker Tutorials, Java Game Programming, Unity3D Tutorials, Batch, C++ and much much more! This is the channel for you, the one stop shop for an exploration of your hidden talent as a game developer. Unleash your potential and go wild with imagination when you finally figure out how to make any game you want!

Visit CodingMadeSimple for more exclusive tutorials and get the help you need to succeed as your very own indie game developer!

Follow me on twitter for exclusive content and interaction with me!

Game Maker Studio: Programming
Game Maker Studio: Tutorial
Java Programming
Game Programming
Game Tutorial
Programming Tutorial


Posted

in

by

Tags:

Comments

42 responses to “Java Game Development #17 – Animations”

  1. Laíres Sales Avatar

    Best channel ever!!

  2. RandomVideos Avatar

    is it possible to string animations to make a cutscene

  3. Matthew Auld Avatar

    This method is very inefficient. You could have an ArrayList<BufferedImage>, then dynamically split up an image into the array to recall.

  4. ben davey Avatar

    mine didn't work please help ive been following along and right when I got to collision detection it doesn't work. the program runs and I can move the player but when I fire at a enemy it doesn't do anything, nothing shows up in the console or anything

  5. Stackersaurus Avatar

    my Player Sprite is animated, but the Enemy sprite is not and it is invisible for a few seconds, then it appears, my console shows me no errors though. ( I did change the row values to 1,2,3 and kept the col value, I also copied what he did with the anim thing)

  6. Amar Burić Avatar

    couldn't you have just used ellipsis in the animation class instead of overloading the constructors 13 times? and use array of BufferedImages? would've been easier. or am i missing something?

  7. Lewisk3 Avatar

    how do i add music?

  8. Tiago Lopes Avatar

    These are seriously awesome videos and you have an awesome channel. It was kind of upsetting when you said "Let's try for 30 likes this time", when I personally prefer you to others such as TheNewBoston who has like millions of views. You are awesome dude, keep it up

  9. TomHazRedstone Avatar

    Ah gosh, the Animation class is so poorly coded…

  10. SPY653 Avatar

    I've got a top down Pokemon styled game how do i change sprite depending on direction?

  11. Pieter Brune Avatar

    Why don't you make an animation lib that runs BufferedImage arrays?

  12. Animation Nation Avatar

    Can you do a tutorial about how to make a platformer in Java Eclipse.

  13. Richard Tester Avatar

    NP your welcome. I am learning myself this was like the second tutorial I did in Java. but I have done some VB, C++, C#, PHP but as a hobby lol

  14. Richard Tester Avatar

    if you are using the same name as the tutorials you will need to change the pa.runAnimation & pa.drawAnimation to what you called it.

  15. Richard Tester Avatar

    Here is one way to do what you ask.
    Game.java

    add to the top with the rest of the variables:
    public static boolean isMoving = false;

    in keyPressed() method add
    isMoving = true; after each movement key

    in KeyReleased() method add
    isMoving = false; after each movement key

    Player.Java
    in the tick(); method put:
    if (Game.isMoving) {
    pa.runAnimation();
    }else{}

    in the render() method put:
    if (Game.isMoving){
    pa.drawAnimation(g, x, y, 0);
    }else {g.drawImage(tex.player[0], (int)x, (int)y, null);}

  16. Richard Tester Avatar

    How would one remove the bullet that destroyed the enemy ship?

  17. ranma314 Avatar

    how do you make the animation stop when a button is released

  18. banananana Avatar

    That animation class, just saying, is a complete mess. You should have an ArrayList of buffered images, and have each frame be timed.

  19. fma64 Avatar

    do you know how could i make an idle animation? something like while(!moving) or somethign like that?

  20. Jake Baker Avatar

    nevermind. I found the answer on your very first tutorial.

  21. Jake Baker Avatar

    I have a problem in my code. do you think I could email it to you to get your opinion on what went wrong?

  22. bugfacedog44 Avatar

    These tutorials are phenomenal! My game looks exactly like yours except:
    spaceship = sick guy
    bullets = puke
    enemies = zombies
    space = park

    hahaha

  23. kora nonta Avatar

    Would you continue your tutorials with other type of games such as 3D 1st person shooter, terrain generation or flight simulator?

  24. Red_Spark Avatar

    Hey, great tutorials.I have small problem about the key listener and the movement.When you go left and right or up and down really fast the movement stop for a sec(sometimes indefinitely) how do I fix that?

  25. RealTutsGML Avatar

    Yes I do, They will be hosted on CodingMadeSimple.
    Our site that will be put up very soon. Help support it here igg.me/at/codingmadesimple

  26. smash melons Avatar

    Do you publish ur own games ? REPLY PLZ

  27. Atle517 Avatar

    Subscribed, so now…gief me dat next video! 😀

  28. Spot9901 Avatar

    Hey, I have everything in the program exactly as you do but when i play the game my fps drops from 8000 to like 5000 really quickly why is this? I know we deleted the code for erasing the bullets that we had before.

  29. Gm Projectx Avatar

    Realtutsgml please do a Paintball tutorial including the enemy ai and stuff. If you can make it 3d 😀 thanks!

  30. Joffrey Bieber Avatar

    Doing it this would require you to make c in Game class a public variable, which is not recommended. You could make a getter "public Controller getC()" which returns c. Then, in the physics class collision loop "game.c.removeEntity(entb.get(­i));". would need to be changed to "game.getC().removeEntity(entb.get(i));"

  31. Joffrey Bieber Avatar

    I know it is spawning all 5 ships from the begining because i put a Print line in the create enemy loop which prints ""Enemy" +i+" spawned". For some reason though, only 3 are showing, and they all spawn at position 0,0 no matter what I put in the parameters for addEntity

  32. Joffrey Bieber Avatar

    Hi I've been following along this tutorial and it is very much appreciated. I'm having a problem I hope you would be willing to help with. For some reason, when my game runs the createEnemy method in the Controller from the call from Game's init, I am only showing 3 ships on screen. They all spawn in the top left corner no matter what x coordinate i put in. After those first 3 pass off the screen, all 5 will come down from random locations as they should@ spawn. Help what might cause ths? Plz,ty

  33. Joffrey Bieber Avatar

    I'm going along with this tutotrial myself but I might be able to help you here. Modify the Collision method in Physics class such that is also takes a copy of Game game in its arguments. Then, in your if statement which returns true. Above the return statement place this statement without quotes "game.c.removeEntity(entb.get(i));". This will call the game object's member method "removeEntity" to destroy the enemy you are considering through this run of the loop (entb.get(i)).

  34. bkboggy Avatar

    Yeah… I know basic Java and advance C++, and I found myself rewinding too much or not knowing why I imported something.

  35. RealTutsGML Avatar

    Glad you are learning!

  36. RealTutsGML Avatar

    Really? I have had comments suggesting that I speed up! Since this is Game Development I am assuming you know basic java. But I will try and slow it down a bit.

  37. bkboggy Avatar

    I wish you'd slow down and explain things a bit more…. a bit too fast pace for me personally.

  38. Adolf Hitler Avatar

    These tuts get better and better, glad I subbed to you ,bro!

Leave a Reply

Your email address will not be published. Required fields are marked *