PICO-8 Top-Down Adventure Game Tutorial - Step 2/10

แชร์
ฝัง
  • เผยแพร่เมื่อ 25 พ.ย. 2024

ความคิดเห็น • 44

  • @kireitonsi
    @kireitonsi 4 ปีที่แล้ว +12

    THESE ARE THE MOST BRILLIANT TUTORIALS! I've always wanted to start learning PICO-8, and now I can!

  • @ratman6313
    @ratman6313 3 ปีที่แล้ว +5

    I'm having trouble with the draw_player function and it's showing an error saying that the "P" variable is a nil value whenever I run the game, I'm sure I put in your script exactly as it shows in your video can you help me fix this?

  • @gbilo24
    @gbilo24 ปีที่แล้ว

    So well explained. Thank you so much.

  • @JairGarcia
    @JairGarcia 4 ปีที่แล้ว +2

    Thank you so much for making these videos! They are top notch!

  • @PossumMedic
    @PossumMedic 3 ปีที่แล้ว

    Good stuff. Time for step 3

  • @yusrimusa1474
    @yusrimusa1474 3 ปีที่แล้ว +2

    2:49 wait what in the middle of x and 8🤨?

  • @martinbecker2164
    @martinbecker2164 2 ปีที่แล้ว +1

    A thought, for the map co-ordinates to pixel co-ordinates conversion, you could pre-calculate them and then use a lookup table, using the map co-ordinate as the key and the pixel co-ordinate as the value.
    Also I honestly like how you described the braces for creating an object as "A big hug", I've honestly never thought about it that way but I like it.
    Subscribed!

  • @cozymonk
    @cozymonk 7 หลายเดือนก่อน

    Why use a period for the variables? "pkey" seems functionally the same as "p.key", but only uses only one token, instead of two.

  • @zoqs1864
    @zoqs1864 3 ปีที่แล้ว +3

    how do you do that thing at SPR(P.SPRITE,P.X,?8,P.X?8)

    • @DylanBennett
      @DylanBennett  3 ปีที่แล้ว +6

      That's an asterisk! A * symbol. (Shift-8 on your keyboard.) That symbol is used for multiplication in coding. Hope that helps! :)

    • @zoqs1864
      @zoqs1864 3 ปีที่แล้ว +2

      @@DylanBennett thank You so much man😁

  • @AnthonyMcNeil-ji2js
    @AnthonyMcNeil-ji2js 7 หลายเดือนก่อน

    My characters Y value isnt changing when i change the p.y value in the make player function nor can i move it up or down when i follow the next tutorial. any help?

  • @jrosrenegadeartanimation6108
    @jrosrenegadeartanimation6108 2 ปีที่แล้ว

    what if my player is bigger than just one tile? if it is 2x2 i mean.. how do i type that out instead? or where can i find that information? thank you and great video

  • @steve_cdh7324
    @steve_cdh7324 4 ปีที่แล้ว +3

    when ever i do ctrl+r to run it takes me to the help menu. help me please

    • @beuwm
      @beuwm 3 ปีที่แล้ว

      try entering the command run instead (esc then type in run)

  • @lumpuslump248
    @lumpuslump248 3 ปีที่แล้ว

    Great tutorial! Subbed!

  • @fletchysketch9338
    @fletchysketch9338 2 ปีที่แล้ว

    my player is 4 tiles big, how do I draw a 4 tiled sprite onto the map?

  • @hdfsyu
    @hdfsyu 2 ปีที่แล้ว

    you can actually just use the name of the sprite, so spr(coin, 10, 10) will work too

  • @sirknumbskull3418
    @sirknumbskull3418 2 ปีที่แล้ว

    Is every variable global? Even it is inside a function?

    • @DylanBennett
      @DylanBennett  2 ปีที่แล้ว +1

      Yes. If you want a variable to have limited scope, put "local" in front of it. That is how Lua works, which is the language PICO-8 uses.

  • @Lumi7-7
    @Lumi7-7 2 ปีที่แล้ว

    this doesn’t work for my version

  • @chunks13
    @chunks13 3 ปีที่แล้ว +1

    i'm a bit late but my player won't show up :(

    • @DylanBennett
      @DylanBennett  3 ปีที่แล้ว

      A couple things to make sure of are that your draw_player() function is _after_ your draw_map() function, and then also make sure that your p.sprite variable points to the sprite number where you made your player sprite. In my example, I drew my player using sprite 1, so I set p.sprite to 1. But if your player sprite is on, say, sprite 5, then you would need to set p.sprite to the number 5. If that still doesn't work, let me know.

    • @MontgomeryHanandCo
      @MontgomeryHanandCo 3 ปีที่แล้ว +1

      Im even later, but I’m having the same problem, my draw_player is under my draw_map and the player sprite number is entered correctly so I have no idea what to do next.

    • @randombox5576
      @randombox5576 2 ปีที่แล้ว

      @@MontgomeryHanandCo same

  • @rbernhardsson9857
    @rbernhardsson9857 2 ปีที่แล้ว

    I have 'runtime error line 13 tae 0
    draw_map ()
    Attempt to call global 'global_map' (a nil value)*

    • @DylanBennett
      @DylanBennett  2 ปีที่แล้ว

      Usually that error means there's a typo in the name of either the draw_map() function on Tab 1, or where you tell it to run the draw_map() function in the _draw() function on Tab 0. Feel free to copy/paste your Tab 1 and Tab 0 code here into a reply if you take a look and don't see anything wrong.

    • @rbernhardsson9857
      @rbernhardsson9857 2 ปีที่แล้ว

      @@DylanBennett
      Tab 0
      "--gameloop
      --runs one time
      function _inite()
      map_setup()
      make_player()
      end
      --runs again and again every 30 sec
      function _updates()
      end
      --runs as _updates, but only after it.
      function _draw()
      cls()
      draw_map()
      draw_player()
      end"
      Tab1
      "--map
      function map_setup
      --map tile settings
      wall=0
      key=1
      door=2
      anim1=3
      anim2=4
      lose=6
      win=7
      end

      function draw_map()
      map(0,0,0,0,128,64)
      end"

    • @DylanBennett
      @DylanBennett  2 ปีที่แล้ว +1

      @@rbernhardsson9857 I see a few things to fix! All of them are small, but they will really throw a monkey wrench into things. First, you have an extra "e" on your _init() function name. (Should be "_init()" instead of "_inite()".) Second, there's an extra "s" in your _update() function name. (Should be "_update()" instead of "_updates()".) Lastly, you need to make sure to add the parentheses to the end of your map_setup() function. Right now it says, "function map_setup", but it should say, "function map_setup()". I hope that helps! If you are still running into issues, please let me know. Don't get frustrated over little typos like that either. Little things like that are easy to miss and super common (even for programmers that have been programming for literally decades).

    • @rbernhardsson9857
      @rbernhardsson9857 2 ปีที่แล้ว +1

      @@DylanBennett Thanks, it did the job

  • @Eeleemos
    @Eeleemos ปีที่แล้ว

    thx

  • @MrOurai
    @MrOurai 4 ปีที่แล้ว

  • @DJDIBLY
    @DJDIBLY 3 ปีที่แล้ว

    Perfect #aangyosa #polmess ❤️❤️❤️❤️❤️❤️❤️❤️❤️❤️❤️❤️ from INDONESIAN

  • @yusrimusa1474
    @yusrimusa1474 3 ปีที่แล้ว

    You should be a computer teacher in school 😊

  • @cheshirecreeper3743
    @cheshirecreeper3743 4 ปีที่แล้ว

    I CAN'T DO THIS! It's a nil value apparently, whatever THAT means. P is not a global variable apparently! I don't know what I'm doing wrong!

    • @DylanBennett
      @DylanBennett  4 ปีที่แล้ว

      I'd be happy to help if I can. Can you post the code you have put in already for tabs 0 and 2? Also, make sure you are running make_player() in your _init() function in tab 0. And then also make sure draw_player() is in the _draw() function.

    • @cheshirecreeper3743
      @cheshirecreeper3743 4 ปีที่แล้ว +1

      @@DylanBennett
      This is in Tab 0:
      --game loop
      function _int()
      make_player()
      map_setup()
      end
      function _update()
      end
      function _draw()
      cls()
      draw_map()
      draw_player()
      end
      This is in Tab 2:
      --player code
      function make_player()
      p={}
      p.x=3
      p.y=2
      p.sprite=16
      p.keys=0
      end
      function draw_player()
      spr(p.sprite, p.x*8, p.y*8)
      end

    • @DylanBennett
      @DylanBennett  4 ปีที่แล้ว +4

      @@cheshirecreeper3743 one small typo! You have "int" instead of "init”, so it's never actually running that function.

    • @lounowell4171
      @lounowell4171 4 ปีที่แล้ว +1

      @@DylanBennett Getting the same error, no typo, my code:
      TAB 0:
      function init()
      map_init()
      player_init()
      end
      function _update()
      end
      function _draw()
      cls()
      draw_map()
      draw_player()
      end
      TAB 2:
      function player_init()
      p={}
      p.x=3
      p.y=2
      p.sprite=64
      end
      function draw_player()
      spr(p.sprite,p.x*8,p.y*8)
      end
      EDIT: OOPS! map_init and player_init round the wrong way !
      EDIT2: Still doesn't work...

    • @DylanBennett
      @DylanBennett  4 ปีที่แล้ว +3

      @@lounowell4171 Just one little missing character! The first function is supposed to be _init() but it looks like you have just init() instead. (Not the missing _ character.)