Тёмный

Managing Game State in Pico-8 

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

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...
The basic code is below:
game={}
function _update()
game.upd()
end
function _draw()
game.drw()
end
function show_state()
game.upd = state_update
game.drw = state_screen_draw
end
or for the token watchers out there:
function _update()
game_upd()
end
function _draw()
game_drw()
end
function show_state()
game_upd = state_update
game_drw = state_screen_draw
end

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

 

19 сен 2024

Поделиться:

Ссылка:

Скачать:

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

Добавить в:

Мой плейлист
Посмотреть позже
Комментарии : 10   
@Kavukamari
@Kavukamari 5 лет назад
so thankful for languages that have functions as first class types, very convenient
@stasoline
@stasoline 3 года назад
Great video for me as a beginner, thank you so much!
@ncsha7317
@ncsha7317 5 лет назад
Thank you, this is a great video!
@1NSHAME
@1NSHAME 5 лет назад
You could do _UPDATE=MENU_UPDATE No need for the GAME table, right?
@Cerbyo
@Cerbyo 5 лет назад
oh ur putting it in init cause it calls it only once at start i see now...so u dont have to setup switches. smartttt. i find it really hard to follow tuts when people use the tabs, its much easier in one tab cause the speaker is then forced to slowdown and show the path more detailed. even easier tho is just use sublimetext or something so we can see everything at once.
@Cerbyo
@Cerbyo 5 лет назад
verboise...lol
@Cerbyo
@Cerbyo 5 лет назад
THIS CODE DOESN'T WORK. I tried doing it 3 friggin times using teh logic u outlined, same error telling me function are nil values. SO I COPIED IT COMPLETELY FROM U AND SAME ERROR, IT DOESN"T WORK!
Далее
Working with the palette functions in Pico-8
13:09
Просмотров 2 тыс.
Scrolling backgrounds in Pico-8
11:04
Просмотров 5 тыс.
연준 (YEONJUN) ‘GGUM’ Official MV
02:44
Просмотров 3,2 млн
Converting between pixels and a tile grid in Pico-8
12:20
Developing a Pico-8 game from scratch - Part 2
18:43
Просмотров 1,9 тыс.
Creating objects using tables in Pico-8
14:44
Просмотров 9 тыс.
Developing a Pico-8 game from scratch - Part 3
24:06
Просмотров 1,9 тыс.
Collisions in Pico-8 using the hit_box() function
15:15
Animating sprites in Pico-8
13:07
Просмотров 11 тыс.
Scrolling backgrounds in Pico-8 (Parallax scrolling)
10:35
Using random numbers in Pico-8
7:54
Просмотров 1,5 тыс.