Sprites not showing even though everything seems to be fine (using NightFox's Lib)

theMADturtle

New Member
OP
Newbie
Joined
Feb 18, 2023
Messages
1
Trophies
0
Age
17
XP
24
Country
Israel
here is my code, I basically want a simple sprite with some top down movement, but I just can't make sprite show up on screen.

C++:
#include <nds.h>
#include <gl2d.h>
#include <stdio.h>
#include <nf_lib.h>
#include <nf_sprite256.h>

//player vars
float playerX = 0;
float playerY = 0;
int playerW = 16;
int playerH = 16;
int playerSpeed = 2;

void playerMovement(){
        //moves the player
        u32 keysDown = keysHeld();
        
        if (keysDown & (KEY_LEFT | KEY_RIGHT | KEY_UP | KEY_DOWN)) {
            if (keysDown & KEY_LEFT) {
                playerX-=playerSpeed;
            } else if (keysDown & KEY_RIGHT) {
                playerX+=playerSpeed;
            } else if (keysDown & KEY_DOWN) {
                playerY+=playerSpeed;
            } else if (keysDown & KEY_UP) {
                playerY-=playerSpeed;
            }
        }
        if(keysDown){
            if (keysDown & KEY_UP){
                if (keysDown & KEY_RIGHT){
                    playerY-=playerSpeed/2;
                    playerX+=playerSpeed/8;
                }
            }
            if (keysDown & KEY_UP){
                if (keysDown & KEY_LEFT){
                    playerY-=playerSpeed/2;
                    playerX-=playerSpeed/8;
                }
            }
            if (keysDown & KEY_DOWN){
                if (keysDown & KEY_RIGHT){
                    playerY+=playerSpeed/2;
                    playerX+=playerSpeed/8;
                }
            }
            if (keysDown & KEY_DOWN){
                if (keysDown & KEY_LEFT){
                    playerY+=playerSpeed/2;
                    playerX-=playerSpeed/8;
                }
            }
        }
}

int main(void) {
    NF_SetRootFolder("NITROFS");
    NF_Set2D(0, 0);   
    swiWaitForVBlank();

    // Initialize the Tiled Sprites System on the Bottom Screen
    NF_InitSpriteBuffers();
    NF_InitSpriteSys(0);
    
     NF_LoadSpriteGfx("player",0,16,16);
    NF_LoadSpritePal("palette",0);
    
    NF_VramSpriteGfx(0,0,0,false);
    NF_VramSpritePal(0,0,0);
    
    NF_CreateSprite(0,0,0,0,playerX,playerY);
    NF_SpriteOamSet(0);
    swiWaitForVBlank();
    oamUpdate(&oamMain);
    while(1) {
        scanKeys();
        glBegin2D();
        
        //render player
        NF_CreateSprite(0,0,0,0,playerX,playerY);
        playerMovement();
        
        NF_SpriteOamSet(0);
        swiWaitForVBlank();
        oamUpdate(&oamMain);
    }
}
 

Site & Scene News

Popular threads in this forum

General chit-chat
Help Users
  • BigOnYa @ BigOnYa:
    It seems too good to be true, but seeing nutterbutter comments, makes me think its good. But I'm already on new dash and think ill wait it out in see.
    +1
  • K3Nv2 @ K3Nv2:
    @BigOnYa, I posted it and you thanked @SylverReZ you drunk lol
  • BigOnYa @ BigOnYa:
    Not gonna use an script online to test, ill wait
  • BigOnYa @ BigOnYa:
    Wut? I'm drunk not me who?
  • SylverReZ @ SylverReZ:
    Guess I was too famous.
  • SylverReZ @ SylverReZ:
    Ive only heard of the Durango dumps.
  • K3Nv2 @ K3Nv2:
    It's a video right above you lmao
  • BigOnYa @ BigOnYa:
    You just connect....and your banned, next
  • K3Nv2 @ K3Nv2:
    Must be drunk
  • BigOnYa @ BigOnYa:
    Nope, California sober tonight
  • K3Nv2 @ K3Nv2:
    Do they even upload older firmware where you can usb update if newer ones do come out
  • BigOnYa @ BigOnYa:
    You can update w USB but they only offer newest updates on they site, they don't give old like ps
  • K3Nv2 @ K3Nv2:
    I mean an archive if a person wants to buy an older Xbox for the exploit
  • K3Nv2 @ K3Nv2:
    I don't think there is a way to archive older update files or no one's cared to so if patched already screwed
  • BigOnYa @ BigOnYa:
    I'm still not sure how it works, but yea MS offers newest updates only, you can't find old
  • K3Nv2 @ K3Nv2:
    I found a internet archive that's up to 2021 that's it
  • BigOnYa @ BigOnYa:
    Or if you are on on old fw, it won't let you online till u update to newest
  • K3Nv2 @ K3Nv2:
    I'm still not getting that hyped over it I can play my pc game that I torrented with a torrent for Xbox that's the same game woo
  • BigOnYa @ BigOnYa:
    But yea @SylverReZ the Durango dumps have all I've heard of till now that was significant
    +1
  • K3Nv2 @ K3Nv2:
    If they enable stealth online like the good old jtag days that'll be different
  • K3Nv2 @ K3Nv2:
    #BringBackGodModeOnline
    K3Nv2 @ K3Nv2: #BringBackGodModeOnline