"Sprites" Part 2 GameBoy programming - write your own Game Boy games - iplayphonegames.com

“Sprites” Part 2 GameBoy programming – write your own Game Boy games

GamingMonsters
Views: 52664
Like: 1259
Write your own GameBoy games using C and GBDK.

Start your journey to becoming an Indie GameBoy games developer by programming your own GameBoy game in C using the GameBoy Developer Kit (GBDK). In this second episode you will learn how to create “sprites” for your characters and how to do simple animation.

If you haven’t watched the first episode in this series we recommend you start there

To see the code from this tutorial see

Make sure you subscribe to the channel and get the next tutorial as soon as it’s released.

GET YOUR PHYSICAL COPY OF DINO’S OFFLINE ADVENTURE

If you want to get your own copy of our game Dino’s Offline Adventure please email [email protected] and we will let you know details very shortly about how to buy a copy of our short run game.

70 Comments

  1. watching video and doing the exact same but mine comes up with this after i try to get sprite to sow up? C:UsersComputerDocumentsgameboy code1-hello world>c:gbdkbinlcc -Wa-l -Wl-m -Wl-j -DUSE_SFR_FOR_REG -c -o main.o main.c

    main.c(5):warning * function 'set_sprie_data' implicit declaration

    C:UsersComputerDocumentsgameboy code1-hello world>c:gbdkbinlcc -Wa-l -Wl-m -Wl-j -DUSE_SFR_FOR_REG -o main.gb main.o

    ?ASlink-Warning-Undefined Global set_sprie_data referenced by module lcc112160

  2. I'm having issues getting my type declarations to work like you have them. You're able to use "UBYTE" or "UINT8" but I can't get that working. For that reason, it's creating errors with some #defines like SHOW_SPRITES, I think. Any ideas? I've never used VSCode before, but I did uninstall it and then reinstall it once (anticipating I'd use it, but never did.). Any help is appreciated 🙂

  3. You could have used. No need for the if statement as there's only two possible values that you're using.

    currentSpriteIndex = !currentSpriteIndex
    set_sprite_tile(0, currentSpriteIndex);

  4. Great videos, man. Can you set the same sprite more that one time? I'm trying but… 🙁

  5. 1:08 I know it's just an example and not trying to be nitpicky, but Super Mario Land never used the Window layer for the HUD. Instead the screen split was used in similar way to SMB1 to make the upper part not movable and the actual level scrolls normally (Not sure if the invisible sprite tile was needed in order to tell the game where the split starts like in NES games) , while that technique eliminates the ability for the main screen to scroll vertically. The only time the WIN layer was used is when you pause the game showing the text in a corner. : )

  6. thank you for this series.
    I would like to point something out, if you want to flip between 1 and 0 quickly just write: currentspriteindex = !currentspriteindex;
    no need for the if-else statement.

  7. Just had a funky error thought i'd share: My sprite was just a black square! Turns out I included the sprite.h instead of .c LOL

  8. This is brilliant! Any chance you'll be making GBC upgrades to support colors? I'd love to make something on that system.

  9. Is there a way to rotate sprites?
    I want to create a big asteroid with sprites wich are using the same texture just rotated.

  10. i understand that the white in sprites are transparent but how does the game Kid Dracula manage to make the white not transparent against a background?

  11. Although I'm not too interested in Game Boy development from scratch due to GB Studio's existence and how weak the hardware is (GBA is my minimum for good gameplay experience), your guide on displaying sprites gets to the point while being thorough. The part of programming courses that I hate the most is that they always start with the command line and never move beyond ASCII; hopefully I can translate these lessons over to the SGDK, another C-based IDE that gets little love in preference of assembly.

    Granted, what platform I'd die for an SDK is the SNES, but beggars can't be choosers, and these kind of projects need more traction first.

  12. Thank you! It's great video. It's great tutorial.
    Is there tile designer for mac user?

  13. This is a fantastic guide, but I have a question for you. How did you manage to enter the text without repeating it? I tried with Printf but it keeps repeating me on screen. how do i solve this problem?

  14. Could you please help me, i get:

    C:UsersRimmertDesktopGBDEVProgrammeergameboySprite test>c:gbdkbinlcc -Wa-l -Wl-m -Wl-j -DUSE_SFR_FOR_REG -c -o main.o main.c

    main.c(7):error * parse error before set_sprite_tile

    main.c(9):error * code not generated for 'main' due to previous errors

    C:UsersRimmertDesktopGBDEVProgrammeergameboySprite test>c:gbdkbinlcc -Wa-l -Wl-m -Wl-j -DUSE_SFR_FOR_REG -o main.gb main.o

    c:gbdkbinlcc: can't find `main.o'

    and i dont know what i have to do to fix it
    any help is greatly appreciated, thank you in advance

    p.s. i love your tutorials

  15. How would I animate my sprite when it has 4 animation tiles instead of 2?

  16. this is awesome. but it really bugs me that you call statements functions

  17. how do i include more than 2 frames of animation into the animation cycle?

  18. Having that dinosaur game on the Gameboy was very funny and cool! Good job! I hope to have the time one day in the near future to put my C programming skills to the test making my own Gameboy games!

    What model of Gameboy is that? What models do you generally need to buy in order to run your own games on them, and where can I get one? also, can I run custom Gameboy games on a Nintendo DS also? I have one of the older versions.

  19. Dear, i made sprite but it blinking and moving right to left very fast as compared to your video. What could be the reason for this ?

  20. It gives the error when I run the bat file
    "main.c:0: error:malformed option `-D USE-SFR-FOR-REG'"

  21. dude, im tired of your tutorial. GB studio is out and it sucks, now i come back to your video and still stuck.
    How did you import all those main. files onto main.c???????
    you never showed how to do it in the first video!!
    I cant move on until you show me how to import all those main. files into the, main.c!!!

  22. I see you using vs code but I see tutorial sand most are in code blocks and I want to learn c in vs code, do you have any recommendations?

  23. For some reason when i compile it makes a copy of hello world

  24. How can you make a GB color game as opposed to just a gameboy game?

  25. why if block the current sprite index rather than modulo it

  26. i keep getting this error, initially i thought it could just be vs being difficult but the same happens if i try to run the make file in the cmd here is the error from the cmd

    C:UsersThomas Billiam

    C:UsersThomas Billiam>cd Documents

    C:UsersThomas BilliamDocuments>cd C++ProjectsForDummies

    C:UsersThomas BilliamDocumentsC++ProjectsForDummies>cd GameBoyProgects

    C:UsersThomas BilliamDocumentsC++ProjectsForDummiesGameBoyProgects>make

    C:UsersThomas BilliamDocumentsC++ProjectsForDummiesGameBoyProgects>c:gbdkbinlcc -Wa-l -Wl-m -Wl-j -DUSE_SFR_FOR_REG -c -o main.o main.c

    C:UsersThomas BilliamDocumentsC++ProjectsForDummiesGameBoyProgects>c:gbdkbinlcc -Wa-l -Wl-m -Wl-j -DUSE_SFR_FOR_REG -o main.gb main.o.make.bat
    c:gbdkbinlcc: can't find `main.o.make.bat'

    C:UsersThomas BilliamDocumentsC++ProjectsForDummiesGameBoyProgects>

    is it a problem of where i put things? or what?

  27. I'm working on Mac, specifically Catalina, and Catalina no longer has support for 32-bit programs, making programs like Wine unusable. Is there a Mac-friendly alternative to this sprite-making program, or another way I could emulate this sprite making program?

  28. I never get a .h file when I export the tiles

  29. everytime i compile the program, it adds main.asm, main. noi and main.ihx. why is that happening?
    Also I try to run the rom but it says 'loading rom succeded with warnings'

  30. can i use just int instead of uint8 ? whats the difference ? thank you

  31. currentsprintindex ^= 1; is the quickest and least amount of code to alternate between two sprites.

  32. I get a weird error about lines 14 and 15 like this:
    main.c(21):warning * conditional flow changed by optimizer 'main.c(14)':so said EVELYN the modified DOG
    main.c(21):warning * unreachable code main.c(15)

    What's this?

  33. this doesn't work for me, all I get is a blank screen and bgb's VRAM viewer has a red line through all the sprite tiles if I click on the OAM tab

  34. actually it's possible to automate the starting of bgb and rom loading by calling bgb from the .bat file.
    open the .bat file and append "pathtobgbexe -rom pathto.gbfile" at the bottom of the .bat file.
    For example I use:
    C:UsersAndreasbgbw64bgb64.exe -rom C:UsersAndreasDocumentsGBDKexpoutputmain.gb

  35. Followed this after fixing an issue and all I get is four black dots in the middle of the screen, not the sprite.

  36. well , i've been avoiding C since 2012 lol , i've used all sorts of game engines to make my games , but i guess i gotta rekindle my toxic relationship with C and start this journey to port a small game i made into my gameboy .
    thanks for the tutorials brother

  37. PS C:UsersAdministratorDocumentsProject Sonic Retrovise> .main.bat

    C:UsersAdministratorDocumentsProject Sonic Retrovise>c:gbdkbinlcc -Wa-l -Wl-m -Wl-j -DUSE_SFR_FOR_REG -c -o main.o main.c

    main.c(23):warning * function 'set_sprite_title' implicit declaration

    C:UsersAdministratorDocumentsProject Sonic Retrovise>c:gbdkbinlcc -Wa-l -Wl-m -Wl-j -DUSE_SFR_FOR_REG -o main.gb main.o

    ?ASlink-Warning-Undefined Global set_sprite_title referenced by module lcc36480

    Any ideas on how to solve this issue?

  38. hey, i want to load a 16×16 sprite but it just shows an older sprite i was using for testing, any help?

  39. Is there a way that I can animate a sprite at a different speed than the main while loop? Like a kind of local delay function. I've tried using two separate while loops, but that just freezes up the emulator. I intend on making a space invaders-esque game, and I'd like the enemies to not be animated at the speed of sound lol

  40. How do I debug my program? I mimicked the code exactly as you put it in your tutorial, but the program wouldn't be compiled. I was abled to comment out lines of code and get it to compile, and then I uncommented one line at a time to test the compiler again, and I found that the move_sprite function wasn't letting the compiler work.

    I was able to figure out that the reason was because I forgot to put the ; at the end of the line, but not before struggling to find any sort of explanation as to why the compiler suddenly wasn't doing anything. In my other experiences with programming, I've always been able to get error messages from the compiler, such as "main.c:11 Missing semi-colon" or something like that. Is there a way that I can set this up or enable something like that? Because as much as I want to get into this, it will be way too frustrating to run into bugs and have no way to effectively debug them.

    P.S.: I tried adding the -debug parameter to the bat file, but it wouldn't produce anything unless the program was successfully compiled.

Leave a Reply

Your email address will not be published.