Game Programming - Episode 51 - More Map Creation
Key Takeaways
The Cherno demonstrates how to create a game map using paint.net and implement it in a Java game, creating new tile types such as flowers and rocks.
Full Transcript
hey what's up guys my name is a j welcome to episode 51 of game programming so I'm actually really tired right now but what we're going to do today is continue um with the game obviously I don't really need to say that but um what we're going to start today is a series of videos that's going to deal with the map now many of you guys really want me to um well the the map basically needs to get developed in this game somehow and um and I thought that I would take the uh next few episodes to actually do that so um Andy will actually send me an updated Sprite a king Cho Sprite thing I'll put that in in a later episode though because um cuz yeah but right now we're going to just open up um paint.net uh and get our image in there so this is obviously our sprad sheet so what I want to do here is um basically make I don't know let's let's just make a few more tiles right so first of all let's just make this entire area um green um and we'll probably just do it to this side as well so this is uh this is this is the episode where I teach you guys how to use paint.net um but seriously uh yeah we're going to probably draw I don't know I'll probably draw like a flower or something here um I like flowers a lot you can tell um and I can't really tell if that's that looks like it's one um oops that was the wrong tool yeah I can't really tell but um it's all right and we could just do this oops all right so this is going to be quite the uh what there we go so flower that looks good doesn't it might need a bit no that's fine um and we'll obviously add some uh some more intricate details here maybe a bit of a bit of a shadow no it's not dark enough and I might also um since we are dealing at a higher resolution here we're not going whoops we're not going like 8X 8 going 16 by 16 I might also um yeah I feel like this net really needs to be bigger um okay I'll just scale it up so it's obviously too big that could work yeah that could work okay there we go so let's let's sort of deal with this um first of all let's get rid of that second of all I think if I get rid of that as well um we'll have a better looking flower Maybe not maybe if I do something like that might look better I don't know what do I know about drawing flowers that just looks rubbish doesn't it yeah I think I like the original design better um welcome to the series where chero tries to draw flowers and fails all right that's going to be fine we're just going to go really simple Graphics just like that there you go flower yay uh one thing I will do though is this um this yellow just is not really doing well in the saturation Department looks really sad so um I'm going to fix that by uh making a bit better there you go maybe just a touch darker but it's still more saturated all right that's going to be our flower and now for the rock um let's just draw something really simple for the rock so maybe like something like that could probably work um and then again we'll take some lighter shades for the uh top cuz that's how we roll and some darker shades for the bottom and voila we got our Rock um yeah if any of you guys want to send me your Sprites go ahead I'll probably use them cuz I doubt that'll be worse than this that flower is um way too big so let's scale that down a bit there there we go all right whoops that shouldn't have happened okay paint pocket that's F all right cool so that's what our thing looks like right now let's go actually I don't like I don't like this um it's too thin let's make it a bit yeah there we go cool so let's take a look at actually um popping that in the code if we go back to our Sprite um stuff we can add a few more tiles so over here in Grass let's duplicate that twice we'll call one flower we'll call one rock they're both 16 size Sprites we know that if we look back in here actually I think I've still got paint on that open um we can see that that's zero right that's 0 0 that's obviously going to be 1 Z and it's going to be two z um so the x of that is one of the flower and the rock is two awesome so let's go back into our random level class quickly that's the thing that's doing it and we can see that way we're actually drawing a number from 0 to three basically anywhere from 0 to 3 so if we go back into our level class over here in our get tile method uh we see that if that tile class if if um if that tiles array at a particular index is equal to zero we're ret turning to grass so let's change this around a bit let's duplicate that twice and say that if if it equals 1 will return flow T FL and finally if it equals um two we'll return tile dot what's the other one rock all right so obviously these haven't been created yet so we can pop over to the tile class really quickly and duplicate This Grass twice and from here we'll just call one flower and we'll call one rock and we'll um will'll also you know adjust these so that's flower it's going to be Rock so yeah I'm going to create sub classes for each of them um if we create class flower tile we'll make sure that it is in the tile package hit finish and if we go back to well first of all let's add the Constructor second of all that's really all we need to do right um we do also need to grab if we go to our grass tile class we also need grab the random method from that copy and paste that into our um where are we flower tile here we go cop and paste that there so there you go it's going to look exactly the same as grass tile really um but for the rock tile it's going to be a bit different so if we um cck class Rock tile finish um let's put pop the Constructor in let's pop the thing the same thing that we that we put into um flower tile and one with one addition right if we go back to tile you see that we've got this solid method let's copy that solid method and put it into rock tile just below the render doesn't actually matter where it is but yeah and we'll just change this return false into return true so that we know it's solid and and in the future when we actually Implement Collision detection which will actually be pretty soon probably in a few episodes it'll probably be within the next five episodes we can actually um we can actually uh you know KN go through rocks so let's launch our game see what we get and look at that we get a bunch of interesting things so first of all you can see there's a lot more grass tiles there aren't any of the two tiles that we've picked now the first thing that comes to mind is that we simply haven't set the Sprite to be the correct Sprite so if we go to tile you can see that all these Sprites are actually equal to sprite. grass so let's change the flower to sprite. flower which we created earlier and roock to sprite. rock let's launch our game and look at that we have different um um different tiles now so yeah those are my really horrible looking tiles if you guys want to send me tiles you just um feel freid to maybe Andy W can send me some tiles I think he did actually I think he did I'm not sure anyway um trees would be nice as well so that's a quick quick little uh thing if you guys want to help me out but um other than that that is uh episode 51 of game programming and I'll see you guys in the next episode L guys
Original Description
Welcome to Game Programming, a series in which we take an in depth look at how to make a game from scratch, in Java.
----------------------------------------------------------------------------------------------------------------
Website: http://www.thecherno.com
Twitter: http://www.twitter.com/thecherno
Facebook: http://www.facebook.com/thecherno
Subreddit: http://www.reddit.com/r/thecherno/
Steam Group: http://www.steamcommunity.com/groups/thecherno
----------------------------------------------------------------------------------------------------------------
Outro music is by Approaching Nirvana: http://www.youtube.com/approachingnirvana
Watch on YouTube ↗
(saves to browser)
Sign in to unlock AI tutor explanation · ⚡30
Playlist
Uploads from The Cherno · The Cherno · 0 of 60
← Previous
Next →
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
3D Game Programming - Episode 1 - Window
The Cherno
3D Game Programming - Episode 2 - Game Loop
The Cherno
3D Game Programming - Episode 3 - Arrays
The Cherno
3D Game Programming - Episode 4 - Drawing Pixels!
The Cherno
3D Game Programming - Episode 4.5 - How Rendering Works
The Cherno
3D Game Programming - Episode 5 - Playing with Pixels!
The Cherno
3D Game Programming - Episode 6 - Performance Boosting
The Cherno
3D Game Programming - Episode 7 - FPS Counter
The Cherno
3D Game Programming - Episode 8 - Alpha Support and More
The Cherno
3D Game Programming - Episode 9 - Beginning 3D
The Cherno
3D Game Programming - Episode 10 - Floors and Animation
The Cherno
3D Game Programming - Episode 11 - Rotation
The Cherno
3D Game Programming - Episode 12 - User Input
The Cherno
3D Game Programming - Episode 13 - Render Distance Limiter!
The Cherno
3D Game Programming - Episode 14 - Basic Mouse Movement
The Cherno
3D Game Programming - Episode 15 - Textures + More!
The Cherno
3D Game Programming - Episode 16 - Walking, Crouching, Sprinting + More
The Cherno
3D Game Programming - Episode 16.5 - Exporting Runnable Jars
The Cherno
3D Game Programming - Episode 17 - Small Adjustments + Birthday!
The Cherno
3D Game Programming - Episode 17.5 - Creating an Applet
The Cherno
3D Game Programming - Episode 18 - The Beginning of Walls
The Cherno
3D Game Programming - Episode 18.1 - A Few More Things
The Cherno
Episode 18.5 - Creating an EXE File in Java
The Cherno
3D Game Programming - Episode 19 - Rendering Walls
The Cherno
3D Game Programming - Episode 20 - Continuing Walls, Fixing Bugs, and Managing Crashes
The Cherno
3D Game Programming - Episode 21 - Texturing Walls, Fixing Clipping, and Fixing the Mouse
The Cherno
3D Game Programming - Episode 22 - Random Level Generator + Properly Fixing Clipping
The Cherno
3D Game Programming - Episode 23 - Graphical User Interface (GUI) Launcher
The Cherno
3D Game Programming - Episode 24 - Making Our Launcher Work
The Cherno
3D Game Programming - Episode 25 - Writing and Reading Files
The Cherno
3D Game Programming - Episode 26 - Custom Resolutions
The Cherno
3D Game Programming - Episode 27 - Decorating the Launcher
The Cherno
3D Game Programming - Episode 28 - Continuing our Custom Launcher!
The Cherno
3D Game Programming - Episode 29 - Launching The Game
The Cherno
3D Game Programming - Episode 30 - Colour Processing In-Depth
The Cherno
3D Game Programming - Episode 31 - Sprites!
The Cherno
3D Game Programming - Episode 32 - Sprite Mapping
The Cherno
3D Game Programming - Episode 33 - High Resolution Rendering
The Cherno
3D Game Programming - Episode 34 - Entities
The Cherno
Genesis - My Game for Ludum Dare 24
The Cherno
Vlog + Ludum Dare Results
The Cherno
Game Programming - Episode 1 - Resolution
The Cherno
Game Programming - Episode 2 - Threads
The Cherno
Game Programming - Episode 3 - Game Loop
The Cherno
Game Programming - Episode 4 - Window
The Cherno
Episode 5 - Buffer Strategy
The Cherno
Game Programming - Episode 6 - Graphics Initialized
The Cherno
Game Programming - Episode 7 - Buffered Image and Rasters
The Cherno
Game Programming - Episode 8 - The Screen Class
The Cherno
Game Programming - Episode 9 - Rendering Pixels
The Cherno
Game Programming - Episode 10 - Clearing the Screen
The Cherno
Game Programming - Episode 11 - "Out of Bounds, Baby!"
The Cherno
Game Programming - Episode 12 - Negative Bounds
The Cherno
Game Programming - Episode 13 - Timer
The Cherno
Game Programming - Episode 14 - FPS Counter
The Cherno
Episode 15 - Tiles
The Cherno
Game Programming - Episode 16 - The Map
The Cherno
The Walls 2 - Minecraft PvP Survival Map
The Cherno
Game Programming - Episode 17 - Key Input
The Cherno
Game Programming - Episode 18 - Controlling The Map
The Cherno
Related Reads
📰
📰
📰
📰
How Creative Characters Like Sprunki Inspire Kids to Learn Coding
Medium · Programming
Computer Applications for Primary School Children: A Fun + Safe Guide for Ages 6-12
Dev.to · Ogunkola Adeola
From 0 to 20 Chapters: My Story‑Driven Rust Book for Kids Now Has a Bilingual Interactive Demo
Dev.to · born1987-ir
How Kids Can Build Fighting Games Stickman in Scratch
Medium · Programming
🎓
Tutor Explanation
DeepCamp AI