30044364 / NES_30044364

Other
0 stars 0 forks source link

Drawing Player/ NPC to the screen #4

Open 30044364 opened 5 months ago

30044364 commented 5 months ago

I have placed each NPC on random locations on the screen. I used the "oam_meta_spr" to print the player and NPC to the screen as shown on the code below.

Player & NPC global variables (locations):

struct BoxGuy BoxGuy1 = {20,20,15,15}; // Player
struct BoxGuy BoxGuy2 = {120,20,15,15}; // NPC 1
struct BoxGuy BoxGuy3 = {140,20,15,15}; // NPC 2
struct BoxGuy BoxGuy4 = {100,70,15,15}; // NPC 3

Draw player & NPC to the screen:

void draw_sprites(void){
    oam_clear(); // clear all sprites
    oam_meta_spr(BoxGuy1.x, BoxGuy1.y, YellowSpr); // Player
    oam_meta_spr(BoxGuy2.x, BoxGuy2.y, BlueSpr); // NPC 1
    oam_meta_spr(BoxGuy3.x, BoxGuy3.y, BlueSpr); // NPC 2
    oam_meta_spr(BoxGuy4.x, BoxGuy4.y, BlueSpr); // NPC 3
}