Java Programming #12 – Textures

[ad_1]
Produce your own Java game from scratch with this very simple, yet very powerful course available right now

In this video we look at loading textures and placing them onto our player and blocks. 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.

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!

Follow me on Google+ to keep updated with all of my tutorials

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


Posted

in

by

Tags:

Comments

26 responses to “Java Programming #12 – Textures”

  1. Hisyam Hanafi Avatar

    today is my birthday thank you for teaching me sensei

  2. Emerald Gaming Avatar

    I'm getting an Exception in thread "Thread-2" java.lang.NullPointerException
    at gameJava.framework.SpriteSheet.grabImage(SpriteSheet.java:14)
    at gameJava.framework.Texture.getTextures(Texture.java:30)
    at gameJava.framework.Texture.<init>(Texture.java:26)
    at gameJava.window.Game.init(Game.java:39)
    at gameJava.window.Game.run(Game.java:72)
    at java.lang.Thread.run(Unknown Source)
    Why is this?
    I know it's returning a null input from somewhere but I don't know how to fix it

  3. Damian Dassen Avatar

    ss? that's an strange name for a variable

  4. devin blevins Avatar

    What did you use to draw your coin image?

  5. BLEAK Avatar

    You can download block_sheet.png and player_sheet.png here
    https://www.dropbox.com/s/nlw7fuu28elmg77/res.zip?dl=0

  6. Ozterkvlt Avatar

    this way of doing it is cool and all but not very flexible. You have to have tons of different RGB values in your loadlevel image to keep track of and you can only use a static sky background image for instance, meaning you cant design levels with changing backgrounds. I'd recommend using a tile software to make your level then exporting it and using that image instead of drawing in each block. Youd have to figure out a way to only draw the part of the image that is on the screen though as using huge images is very slow

  7. Ozterkvlt Avatar

    i know this video is old and you prolly wont reply, but does anyone have a method of making slanted surfaces for the player to walk on?

  8. Areeb Raza Avatar

    its not working for me, it doesn't draw the dirt blocks for me, if some one can help me, please tell me their email address so i can email my code and then they can fix my project and send it back to me.

  9. Etto Rigo Avatar

    if(red == 128 && green == 128 & b…..orif(red == 128 && green == 128 && b….?

  10. Julio Padilla Avatar

    So i can run my game good and everything but the only thing is that when i load the image of the player i get the white background that the player has in the SpriteSheet how can I get rid of that and just be able to load the image of the player?

  11. Criticaldiamonds Avatar

    GUYS: If you want to increase your FPS, this is an easy solution.
    This is the render method of your Block class.
    What it does is only render if the block is inside the screen, otherwise it isn't rendered. this increases FPS by a lot because there is no reason to render things outside the screen… Hope this helps!

    public void render(Graphics g) {
    // Cull blocks outside the screen to increase FPS
    if ((this.x > -Camera.getX() + Game.WIDTH) || (this.x < -Camera.getX() – 32) || (this.y > -Camera.getY() + Game.HEIGHT) || (this.y < -Camera.getY() – 32)) {
    ;
    } else {
    if (type == EnumBlockID.DIRT) {
    g.drawImage(tex.block[0], (int) x, (int) y, null);
    }
    if (type == EnumBlockID.GRASS) {
    g.drawImage(tex.block[1], (int) x, (int) y, null);
    }
    }

    }

  12. Emily James Avatar

    Where can i find the block sheet and player sheet?

  13. Sourabh Singh bais Avatar

    Cool! Yo! mate this is great level creating method. 😀

  14. austin moyer Avatar

    i broke it ._. idk how but it says there are no errors but when i run it, it says:
    at com.dreadeye38.neon.window.Game.init(Game.java:41)
    at com.dreadeye38.neon.window.Game.run(Game.java:74)
    at java.lang.Thread.run(Unknown Source)

  15. Aslhax Avatar

    Does anyone have a player_sheet and a block_sheet that I can download? Please and thanks so much!

  16. joe cooney Avatar

    where does he add the scaling?

  17. Carlos Herrera Avatar

    Which program did you used to create those spritesheets? 

  18. bam24ful Avatar

    how to you upload the character texture without the white background

  19. CriticaldiamondsCode Avatar

    +RealTutsGML 
    How do you fix the player clipping through the blocks? You said that you were going to fix it at the end of your last video!

  20. Epicnerd73 Avatar

    Ok, I would have thought you would explain how to make the textures, because I have no idea how to in terms of sizing and stuff…

  21. MultiDevan13 Avatar

    hey guys check out this simple game i made.. it about post apocalyptic world. "zombies included" and tell me if you like it
    http://www.mediafire.com/download/3u8b174wv068vl2/Apocalypse.rar

  22. Feysal Imraan Avatar

    I just hate the fact that i cant access these images in this videos. That brings me almost to a stand still. Bro, cant we have some kind of a Google Drive so we can access such kinda resources?

  23. Dominic Bruno Avatar

    Lol that moment when you mix objects up, and have hundreds of the player sprite as your foreground tiles…

  24. Stefan Velickovic Avatar

    i have problem with texture, mine blocks are taking a block section but and rests blocks and lavas coins appears too. i check twice the code is like yours but probably i miss something? anybody have similar problem?

Leave a Reply

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