I need some help getting this thing off the ground. Maybe some insight in to how the 1/4 Heart containers work would be helpful.

In Psudo Code:

Declare var PMC /*Peice of Magic*/

Upon Pickup
PMC = PMC +1

if PMC = 4 {
Increce magic containers by 1
PMC = 0
}

if PMC = 0 {
Display 0 Tile on subscreen at (X,Y)
}

if PMC = 1 {
Display 1 Tile on subscreen at (X,Y)
}

if PMC = 2 {
Display 2 Tile on subscreen at (X,Y)
}

if PMC = 3 {
Display 3 Tile on subscreen at (X,Y)
}

end

Forgive me if this is too sloppy. I Guess what I need to know is what a code that Executes upon item pick up looks like, and any pit falls I should know about placing things on the subscreen (Will the Magic container Icon need to be refreshed on a regular basis?)