Тёмный

Pico-8 Collisions with background tiles using fget and mget 

doc_robs
Подписаться 1,4 тыс.
Просмотров 8 тыс.
50% 1

Опубликовано:

 

18 сен 2024

Поделиться:

Ссылка:

Скачать:

Готовим ссылку...

Добавить в:

Мой плейлист
Посмотреть позже
Комментарии : 30   
@funniestmanalive221
@funniestmanalive221 Год назад
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.
@tobobobo2842
@tobobobo2842 5 лет назад
Can’t tell you how helpful these are. Thank you so much for posting.
@wilsonfromwales
@wilsonfromwales 3 года назад
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!
@jxsingvogel
@jxsingvogel 3 года назад
This is so well explained. I understand everything the first time, I see it. Due to your systematic approach, I even see your small errors before you correct them yourself :) . Thank you so much for your videos!
@truckjumperdude
@truckjumperdude 3 года назад
Great video! Very easy to understand and implement into my game.
@eboatwright_
@eboatwright_ 3 года назад
Thanks for this! :D
@DefaultChef
@DefaultChef Год назад
always makes me move without stopping and when i collide, i cant move at all to any direction that doesnt have a wall
@wizerr9314
@wizerr9314 4 года назад
there is an issue. when we collide diagonally, the player get stuck in the wall by one pixel
@ossoace
@ossoace 3 года назад
That happens to me! It's because the player is on a non-collidable tile, then when it adds dx its still on a non-collidable tile, same with dy but if it added dx and dy, it would find they collide.
@m4ank
@m4ank 2 года назад
You don't have to worry about that! Even on the original Super Mario Brothers., Mario gets stuck 1 pixel in the wall!
@thejuicebox6470
@thejuicebox6470 Год назад
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.
@docrobs
@docrobs Год назад
It's just a generic variable to allow the For loop to happen. It effectively stores which corner you are looking at.
@thejuicebox6470
@thejuicebox6470 Год назад
@@docrobs so like a counter variable/sentinel?
@docrobs
@docrobs Год назад
@@thejuicebox6470 Yes, but it does represent more than simply a counter as it stores either x (left) or x+w (right).
@etclee6630
@etclee6630 5 лет назад
much appreciated!
@doriantermini
@doriantermini 5 лет назад
The piece of code that says "DO" doesn't work. I do not understand why.
@docrobs
@docrobs 5 лет назад
What sort of error do you get? Pico-8 is pretty good at helping you narrow down what the issue might be.
@guilhermemouraleite7373
@guilhermemouraleite7373 Год назад
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
@willshrly76
@willshrly76 5 лет назад
I cant seem to find my error. I followed the instructions and checked against your code. My sprite is colliding perfectly. However, it just continues to move in any direction I give it without stopping (unless colliding). Any suggestions?
@docrobs
@docrobs 5 лет назад
Hi, Post your code here and I'll take a look - it could be a number of things.
@willshrly76
@willshrly76 5 лет назад
Hello, I was unable to copy the code here. Is the sprite supposed to stop moving after pressing the arrow keys in your code? For example, in my version if I pressed left arrow once, it would go left but just continue until leaving the screen or hitting a wall.
@docrobs
@docrobs 5 лет назад
@@willshrly76 Yes - it's just a quick demo. If you want it to only move when you press the buttons add dx=0 and dy=0 at the top of the update loop.
@wilunki18
@wilunki18 5 лет назад
@@docrobs can you check my code as well? I'm unable to move after touching a wall.
@noobmaster6387
@noobmaster6387 3 года назад
I stopped being able to move as you did x y and d y
@kittyn5222
@kittyn5222 2 года назад
My brain gave up immediately
@pocoknight8209
@pocoknight8209 3 года назад
the code breaks when the player si flipped
@gwk2856
@gwk2856 2 года назад
The fget doesnt work when i print it, it always says 0
@docrobs
@docrobs 2 года назад
You have set the flags for each sprite haven't you?
@gwk2856
@gwk2856 2 года назад
@@docrobs yes, I tried every flag and they were all 0
@kittyn5222
@kittyn5222 2 года назад
@@gwk2856 I am getting a similar problem it's not showing the flag it just says nil
Далее
Working with the palette functions in Pico-8
13:09
Просмотров 2 тыс.
Scrolling backgrounds in Pico-8
11:04
Просмотров 5 тыс.
🧙‍♀️☃️💥 #ice #icequeen #winter
00:14
Просмотров 61 тыс.
WHO IS MORE GREEDY?!
00:18
Просмотров 934 тыс.
Converting between pixels and a tile grid in Pico-8
12:20
Live Coding Snake with Pico-8 in 20 minutes
21:46
Просмотров 6 тыс.
Collisions in Pico-8 using the hit_box() function
15:15
Developing a Pico-8 game from scratch - Part 3
24:06
Просмотров 1,9 тыс.
Understanding Memory in PICO-8
53:41
Просмотров 12 тыс.
Particles in Pico-8 - The Ultimate Guide
16:49
Просмотров 6 тыс.
Drawing Walls - 3D in Pico-8 #1
10:46
Просмотров 22 тыс.
PICO 8 Tips | Using External Tools
15:23
Просмотров 14 тыс.
Let's make a PICO-8 Game in 30 Minutes!
30:18
Просмотров 74 тыс.
Scrolling backgrounds in Pico-8 (Parallax scrolling)
10:35