- 24
- 87 338
doc_robs
United Kingdom
Приєднався 29 сер 2018
Developing a Pico-8 game from scratch - Part 5
Part 5 of the series of videos looking at building a Pico-8 game from scratch.
As promised, this is the video detailing collisions and, as a consequence, is longer than most. I go through the basics of hit_box collisions and look at integrating that into the main game loop.
As promised, this is the video detailing collisions and, as a consequence, is longer than most. I go through the basics of hit_box collisions and look at integrating that into the main game loop.
Переглядів: 2 471
Відео
Working with the palette functions in Pico-8
Переглядів 2,2 тис.5 років тому
This video looks at the two palette functions pal() and palt() to allow you to control colours and transparency.
Developing a Pico-8 game from scratch - Part 4
Переглядів 1,5 тис.5 років тому
The fourth in a series of videos looking at completing a video game in Pico-8. This video looks at adding some more objects to the game (this time asteroids). It shows that, once you have the basics in place, you can quickly add all sorts of objects to your game. The next video deals with collisions - that'll be the big one!!
Developing a Pico-8 game from scratch - Part 3
Переглядів 1,9 тис.6 років тому
The third in a series of videos looking at completing a video game in Pico-8. I go through the various thought processes involved with taking lots of ideas to a finished game. In this video, I look at creating bullets by using tables the create objects. I also get stuck trying to debug problems with the code!!
Developing a Pico-8 game from scratch - Part 2
Переглядів 1,9 тис.6 років тому
This is the second in a series of videos looking at completing a video game in Pico-8. I go through the various thought processes involved with taking lots of ideas to a finished game. In this video, I look at getting the background star field scrolling down the screen.
Developing a Pico-8 game from scratch - Part 1
Переглядів 4,3 тис.6 років тому
This is a first in a series of videos looking at completing a video game in Pico-8. I go through the various thought processes involved with taking lots of ideas to a finished game. In this video, I look at getting the player sprite moving around the screen.
Converting between pixels and a tile grid in Pico-8
Переглядів 1,3 тис.6 років тому
This short tutorial looks at using the floor function flr() to calculate the grid reference of an object when you know its position in pixels. It also looks at how to then convert this back to the pixel location of the grid reference.
Pico-8 Collisions with background tiles using fget and mget
Переглядів 8 тис.6 років тому
A tutorial that looks at using the fget and mget functions to allow collisions with a tiled background.
Adding forces to you games - mainly gravity!
Переглядів 1,3 тис.6 років тому
How to implement forces in your games. This tutorial mainly looks at gravity, but touches on forces in all directions. I also look at air resistance and bouncing off edges and starts to cover how to get an object to jump.
Collisions in Pico-8 using the hit_box() function
Переглядів 6 тис.6 років тому
This video builds on the previous video which looked at the hit_box() function to actuall implement pixel-perfect collisions for you games. This is done in Pico-8, but it could be implemented for any programming language as it is the method that is important.
Scrolling backgrounds in Pico-8 (Parallax scrolling)
Переглядів 4,2 тис.6 років тому
This tutorial explands of the first one (ua-cam.com/video/wFJqmqzwOxo/v-deo.html) and looks at adding parallax scrolling to you game. This is a great way to simulate depth in a game. Again, I should mention that if your map is wider than 16 tiles, you should adjust the value of 128 accordingly. So, for example, if your map is 20 tiles wide, you would replace 128 with 160 (i.e. 20x8).
Scrolling backgrounds in Pico-8
Переглядів 5 тис.6 років тому
Putting in place a simple scrolling background for a Pico-8 game. This video looks at a simple technique for having an endless scrolling background in your game. It's worth me mentioning that if your map is wider than 16 tiles, you should adjust the value of 128 accordingly. So, for example, if your map is 20 tiles wide, you would replace 128 with 160 (i.e. 20x8).
A collision function for Pico-8
Переглядів 8 тис.6 років тому
This video looks at how to write a function that can be used for collision detection in Pico-8. It makes use of bounding boxes to return true or false depending on whether two boxes overlap. The code is found here: gamedev.docrobs.co.uk/first-steps-in-pico-8-hitting-things (I can't post the full code as UA-cam doesn't allow greater than or less than signs)
Managing Game State in Pico-8
Переглядів 2,6 тис.6 років тому
Keeping track of game state (menu, game over, splash screen, etc) can be tricky. This video give you an easy way of doing this using variables for _update and _draw that are called for each state. I use a table to store the variables but, for the token-conscious amongst you, you could just use variables. See my blog for a more detailed description: gamedev.docrobs.co.uk/game-state-in-pico-8 The...
Easing Functions in Pico-8
Переглядів 1,8 тис.6 років тому
This tutorial runs through easing functions and how to incorporate them in Pico-8. Easing functions allow non-linear movement between two locations (or, indeed, non linear actions in general). The tutorial uses the library of easing functions available here: www.lexaloffle.com/bbs/?tid=32124 Simply copy the easing function from the second tab, or the specific easing function from the third tab ...
Creating objects using tables in Pico-8
Переглядів 9 тис.6 років тому
Creating objects using tables in Pico-8
Dealing with the edge of the screen in Pico-8
Переглядів 1,3 тис.6 років тому
Dealing with the edge of the screen in Pico-8
Diagnosing and fixing errors in Pico-8
Переглядів 1,3 тис.6 років тому
Diagnosing and fixing errors in Pico-8
Drawing shapes to the screen in Pico-8
Переглядів 1,3 тис.6 років тому
Drawing shapes to the screen in Pico-8
Thank you very much. I am very happy with the time and the teaching style.
This is an excellent video! This perfectly explains something I've been having trouble with!
Lovely video. Very helpful.
Excelent stuff here! I'm new to Pico8 and I'm really loving it. But guys, I really don't understand the reason people uses multiple multiplications like x*x*x instead of x ^ 3. Is there any reason?
where'd you go..?
for someone who is brand new to pico-8 you've done a great job explaining it and helping me get an understanding of the program. Great job.
Used your code for my single screen platformer game. Many Thanks 👍
Does anyone know if pico8 had any updates that make this code a little broken? I have the exact same code and the sprites with the same flags, but my character randomly changes direction even if I don't press any button, it looks like it "collides" with blank spaces on the map and then goes on a different axis. Here's the code: grid_x=0 grid_y=0 flag_tile=0 x=63 y=63 dx=0 dy=0 function _update() grid_x=flr(x/8) grid_y=flr(y/8) flag_tile=fget(mget(grid_x,grid_y),0) if btn(0) then dx=-1 end if btn(1) then dx=1 end if btn(2) then dy=-1 end if btn(3) then dy=1 end if hit(x+dx,y,7,7) then dx=0 end if hit(y+dy,x,7,7) then dy=0 end x+=dx y+=dy end function _draw() cls() map(0,0,0,0,16,16) spr(2,x,y) print(grid_x..","..grid_y,5,5,7) print(flag_tile,5,11) end function hit(x,y,w,h) collide=false for i=x,x+w,w do if fget(mget(i/8,y/8))>0 or fget(mget(i/8,(y+h)/8))>0 then collide=true end end return collide end
amazing tutorial
Hey uhhh doc robs how do u even make backgrounds?
Thanks a lot such amazing to learn that
you are like the khan academy of Pico-8 tutorials
question how would you use the S variable when you are using an SSPR sprites I'm working on a thing in class so I don't have any audio
Please write a book!
I hope you make more of these too ! Thank you!
always makes me move without stopping and when i collide, i cant move at all to any direction that doesnt have a wall
Great vid! I have one question, how do you make it for the up and down animations. I tried to make it with the same code just different animations, it didn’t work. Could you please help:)
Thank you so much for this video! I deeply appreciate you explaining how to round it to an integer, this is exactly what I was looking for!
Well I got to 2mins 20 before being utterly out of my depth. Was worth a look though but jeez I wish pico-8 had a built-in collision command (like detectSpriteCollision(sprite1, sprite2) and it returned true if there was a collision.) as it stands now, pico-8 is fun but collision is an utter nightmate and might be the one thing that stops me from making games in this. a pity
Could someone explain what the `i` variable is for in the `for` loop? My code works, but I didn't catch him explaining it in the video.
It's just a generic variable to allow the For loop to happen. It effectively stores which corner you are looking at.
@@docrobs so like a counter variable/sentinel?
@@thejuicebox6470 Yes, but it does represent more than simply a counter as it stores either x (left) or x+w (right).
does anyone know how to make the loop longer? can I use the whole span of the x-axis of the map to create a longer loop? how do I do that in the code?
thank you so much, you helped me a lot, thanks for taking your time to record such a great tutorial. awesome radio voice and audio btw
perfect ..thank you!! exactly what i needed=)
These are excellent videos!
super cool, made it seem simple and now I understand how not to change every color but only the one sprite I need
Random numbers were such a headache in NES games. Pseudorandom numbers are often calculated as a bit shifting and reordering operation, but you need to be extremely careful to use an operation that doesn't have any predictable results. Imagine if your random number generator always returned 4, then 6, then 1, 4, 6, 1, 4, 6, 1. That could be a disaster, if you want it to be unpredictable, or to produce every possible value. The original Final Fantasy hardcoded a list of a few hundred predetermined numbers, and calling the equivalent of rnd() just looked up the next value in that table; that was the most reliable solution the programmer came up with. PICO8 being emulated allows it to pull unpredictable values from the host system, so rnd() is incredibly easy and incredibly reliable.
one question: What is the game you showed first? Could you tell me?
My brain gave up immediately
Hey Doc, thank you for all your tutorials. You have a very clear and calm way of explaining things, please don’t give up on making these excellent Pico-8 tutorials! We are sorely lacking in excellent video tutorials for this wonderful software!
Please continue this, I found you while looking for background scrolling and find your videos very useful. Thanks a ton
Anyone know why mines saying self is a nil value?
Could you use btnp to space out the bullets?
Hi. Not really. BTNP reports TRUE only for the next frame after the button has not been pressed, so it reports FALSE for a button hold. You'd need to mash the button to have it use BTNP.
Thank you so much for your videos Doc! You've helped me so much in my game dev journey!
Sooo good!!!
Searched UA-cam to learn how to do this. This explained it perfectly. Thank you.
I really appriciate this video! I fixed my problem in a few moments.
Amazing tutorial, as always. I was coming into this thinking I'd know everything already, but I was entirely unprepared for being able to put FUNCTIONS into objects. Not that I'm an expert, but I had read the documentation and, as far as I could tell, it makes no mention of this function-ality (ha). I'm going to have to revamp a couple of my projects to use this knowledge now.
The fget doesnt work when i print it, it always says 0
You have set the flags for each sprite haven't you?
@@docrobs yes, I tried every flag and they were all 0
@@jizza09 I am getting a similar problem it's not showing the flag it just says nil
Instead of adding values one by one all the time, you can check if the x+SPEED value is not going to collide and add the whole speed otherwise you add values one by one until you reach the collision point. Great tutorial!
Good idea!
Quick Question, what if i wanted to make a space shooter, and my ship is trying to move in a way where if i go right it goes to one sprite change of it turning left or right.
If you mean rotating a sprite, that's on a whole new level. You could draw several sprites or apply some maths to the whole thing but that's a whole new tutorial!
thank you so much for this this has help me make so many games.
I stopped being able to move as you did x y and d y
my map is larger than 127x127, i wanted to make my character stop when on the edge of the camera, but its stoping on the edge of the map tile please help
If you have a camera and a map, they each have their own coordinate system. You need to be careful to know when "x" refers to the map coordinates or the camera coordinates. I hope you managed to solve this on your own. Good luck in your future endeavors!
Hello is it possible to have the game cartridge? thanks
are you going to continue this
@doc_robs thank you for the wonderful tutorial series! However, I do have a question regarding collision. I have followed both this tutorial and the fget mget collision tutorial. I have attempted to combine the two but when I try to return the X, Y, W, H to the collision i am receiving runtime error at IF HIT(X+DX,Y,W,H) THEN. "ATTEMPT TO PERFORM ARITHMETIC ON GLOBAL 'X' (A NIL VALUE)". Is this because the object BULLET has no way to index values? Any help would be greatly appreciated. Cheers!
function _init() x=63 y=63 dx=0 dy=0 w=1 h=1 bullet={} end function _update() if btnp(🅾️) then add_new_bullet(2,0) dx=bullet.dx dy=bullet.dy x=bullet.x y=bullet.y w=bullet.w h=bullet.h end for b in all(bullet) do b:update() end if hit(x+dx,y,w,h) then dx=0 end if hit(x,y+dy,w,h) then dy=0 end x+=dx y+=dy end function _draw() cls() map(0,0,0,0,16,16) spr(2,x,y) for b in all(bullet) do b:draw() end end function hit(x,y,w,h) collide=false for i=x,x+w,w do if fget(mget(i/8,y/8))>0 or fget(mget(i/8,(y+h)/8))>0 then collide=true end end return collide end --bullet function add_new_bullet(_dx,_dy) add(bullet,{ x=63, y=63, w=1, h=1, dx=_dx, dy=_dy, draw=function(self) pset(self.x,self.y,7) end, update=function(self) self.x+=self.dx self.y+=self.dy end }) end
Hi, It could be that you have the function HIT running in the UPDATE function every turn but not specifically for an instance of BULLET. Try embedding the HIT function into the BULLET UPDATE function instead. There is a good chance that this might break things the first time you try it, so I would use the comments to delete code rather than actually deleting it, then you can roll back changes if it doesn’t work!
@@docrobs Thanks!
As I continue to learn PICO-8, I always come back to your videos as the best tutorials with the best explanations, and no time wasted. Thanks again!
Wow! I've been trying to do this!
This video isn’t very good you leave multiple things un explained
hey mate, loved all your videos. sad to see they seem to have ended, but i appreciate that you made them in the first place! Would love to see how you make a functioning game with different tabs for the init, update, draw!