Hi! My name is Dylan Bennett. I'm gonna show you PICO-8! It's a fantastic
game engine for what I like to call "delightful game development". Basically
PICO-8 is like an emulator for a console that never existed. I'll show you
how it works. This is the code editor where you write all of your code for your game.
This is the sprite editor where you draw the pictures and art for your game. You
only get these 16 colors, and that's it. We'll come back to this. This is the map
editor. If your game has a map, you can use the sprites you've created as map
tiles for your game. This is the sound editor. It's SUPER easy to use. You just
draw the sounds you want for your game. Like this. You can also have different
instruments you use. Like this. And if you're musically inclined, you can switch
to what's called "tracker mode" and see the actual notes that make up the sound.
From here, you can do things like change the transition between the notes. And
lastly you have the music editor here, where you can use the sounds you created
in the sound editor as tracks for your music. Let's go back to the code editor.
PICO-8 has three core functions you can use to control the flow of the game. You have
_init(), which happens at the very beginning of the game. You have _update(),
which happens 30 times a second. And then you have _draw(), which also happens 30
times a second, but happens after update. So let's say in _draw() we have it clear
the screen every frame. The whole screen is just 128 pixels by 128 pixels, so
let's have it draw a pixel right in the center. Using a command called pset, we
say how far over and how far down, and then what color. And remember we only get
16 colors! So let's pick one. Say... 12, for blue. Now we run this... Boom! There it is!
Nothing special, but it works. Back in the code, let's make this easier to change. So
up in _init() let's add x=64 and y=64. Now for pset, we can just say x
and y. When we run it, it still does the same thing, but it works. But now we can
go in the _update() function and listen for button presses.
So if we say button-left, then x-=1 and if button-right then x+=1.
And if button-up, then y-=1 and if button-down, then
y+=1. Now when we run it, look at that! We can drive around our pixel.
So easy! But let's say we want to have a little character running around instead
of just a pixel. So we'll go into our sprite editor and let's make one.
So there we go. Now, notice we drew this in sprite #1. We have lots of
sprites to choose from, but this happens to be in #1. So if we go back to
our code, instead of drawing a pixel at x and y, we can say draw sprite #1
at x and y. And now when we run it, boom! We have a character running around the
screen! You can see how easy it is to get up and running with PICO-8. Now, what
if we want to add sound to this. We just go to our sound editor and we can draw a
sound. And we can change the volume so it fades off. And now listen. [cha-ching!] Look at
that! We have a coin sound! Let's add it to our game. So if we go in the _update()
and we say, if they press button, say, x, then play sound effect 0. And we run
it... [cha-ching!] [cha-ching!] [cha-ching!] Look how easy that is. But now let's make our game really cool by adding a map. If we
go in the sprite editor, you'll see we have no map tiles. So let's make some.
Now that we have some map tiles, let's go add them to our map.
Look at that! We've got a cool map. That looks awesome. Let's go into our code and
add it. So now, after we clear the screen, let's draw the map starting from map
tile 0, 0. Now when you run it... Look at that! Our character has got a whole
map to run around on. How cool is that? We've seen how easy it is to get up and
running, but what about sharing your game with others? I mean that's the whole
point in making them right? I love how easy PICO-8 makes it to share what you
create. Before we do that, let's add a title to our game.
Maybe "my cool game", "by Dylan". And then let's run it. And let's hit the F7 key.
And notice it said it captured a label image. Now when I go to the command line,
I can type "save mygame" and then we're gonna say ".png", and watch what happens.
You see that? It created a game cartridge of our game. This PNG image *is* our game!
It has everything! This one PNG image has all the code, all
the sprites, all the map data, all the music, all the sounds. It's all right
there inside that PNG file! And I can just share that PNG file with anyone. I
can post it on a website. I can email it to someone. And then they have my whole
game. All of it! How cool is that?! But that's still not
even the coolest part! See, if I give someone this game cartridge, they still
have to have PICO-8 in order to run it. What if I want anyone to play my game, even if
they don't have PICO-8? Simple! Watch this! I just type "export mygame.html" and
boom! It exports an HTML5 version of my game that can run in the browser. Check
it out! I just open up that HTML file, load it in the browser, and look at this!
It's a whole copy of my game that runs inside the browser! Just like in PICO-8!
And down here I can even go fullscreen too, if I want to give them the
full experience. How cool is that?! Right? And I still haven't shown you the
coolest part. One of the greatest things about PICO-8 is the amazing community of
culture and sharing and collaboration it has. And that's built right into PICO-8. If
you use this feature called "splore", you can see all these other amazing things
that people have been creating with PICO-8. And you can
pick one, and load it up. Like this one, for example. And boom! Right here, I can
play this game which someone else created. And then, if I decide, "You know what? I actually
want to see this for myself!" and I can go in, in here, I can look at all the code
that was used to create that game. And I can see all the sprites that were used!
Here's the map data! The sound! All the music! And, for instance, in the map, I
can go here. And, say I want to change this up a bit, and make this a little bit
different. And then when I run it, there it is! I just changed the game myself. And
I can go back into the code, and I can learn from what this person did to
create their game, so that I can make my games better! I love this! At this point, I
hope you will now understand why I refer to PICO-8 as "delightful game development".
You can just go to PICO-8.com and get it from there. It really is a wonderful
environment to create in, and I *hope* you will join me. Thank you for watching.
Không có nhận xét nào:
Đăng nhận xét