The @ Symbol and here is Your Sword

SeaFoodAndButter

New member
So I've been following the Advent. Tutorial but not exactly. I followed most of the steps but I used my own character's graphical assets instead of the tileset that Joe uses. Therefore, when I use a text string and add the @ symbol to add a melee weapon, it pulls the wrong graphic to draw in my HUD (it pulls a piece of my character's stomach). I looked at my tileset and compared it to the one Joe provided and I see why it is pulling the wrong graphic - I don't have a sword in that area. It's also drawing this wrong graphic in the wrong place I want on my HUD.

My questions: 1- Where can I adjust the place where the graphic gets pulled from?; How can I determine where, in my game object tileset, the HUD will pull the graphic for the @ symbol Joe set up? 2- How/Where do I determine where it is drawn in my HUD?
 

Bucket Mouse

Active member
The @ symbol actually isn't an allowed character in the text string, and as far as I know, they provide no way of changing this.
 

dale_coop

Moderator
Staff member
For text boxes, the symbols:
@ = the "_USER_0" tile from the HUD tiles
# = the "_USER_1" tile from the HUD tiles
$ = the "_USER_2" tile from the HUD tiles
% = the "_USER_3" tile from the HUD tiles
It means, that in the "HUD > Tiles" you can set any tile you want for them (select "_USER_0" in the list, and select with tile to use)
 

SeaFoodAndButter

New member
Bucket Mouse said:
The @ symbol actually isn't an allowed character in the text string, and as far as I know, they provide no way of changing this.

Watch https://www.youtube.com/watch?v=wH6G296onhs&t=6991s and go to 1:09:48, and watch him from there. You will see that he has defined certain symbols, when placed in the text, to mean certain things. One of those symbols is the @ symbol. What it does is pull a specific graphic from a specific spot in both the HUD tileset and GameObject tileset and draws one in the text and then the other in a specific area in the HUD.

Basically, the way he has it set up is that the @ symbol in text draws a graphic in the text (it pulls this graphic from the HUD tileset), and then it draws a graphic in the HUD (it pulls this graphic from the GameObjects tileset). However, unless you import the exact HUD tileset and GameObject tileset that comes with the Adventure Module, if you use the @ symbol in your text it will not draw the right graphic in the right spot in your HUD. The only way to make it work is to make your GameObject tileset and HUD tileset EXACTLY like Joe's; but I don't want that. I want my own.

So, my questions are basically: Where/how do I manipulate the place this @ symbol pulls 1) the graphic from my HUD tileset to draw in the text? 2) pulls the graphic from my GameObject tileset, and 3) how to determine where it draws this graphic in my HUD.

I need to know this so I can pull the proper graphic from my HUD tileset to be drawn in my text dialogue; pull the proper graphic from my GameObjects tileset; and have the right graphic placed in the right spot in my HUD. Without this information my graphics in the dialogue and HUD will not be custom to what I want.
 

SeaFoodAndButter

New member
dale_coop said:
For text boxes, the symbols:
@ = the "_USER_0" tile from the HUD tiles
# = the "_USER_1" tile from the HUD tiles
$ = the "_USER_2" tile from the HUD tiles
% = the "_USER_3" tile from the HUD tiles
It means, that in the "HUD > Tiles" you can set any tile you want for them (select "_USER_0" in the list, and select with tile to use)

Thank You Dale, you posted your answer before I could clarify what I was asking!

Thanks again!
 

dale_coop

Moderator
Staff member
No in ga r in his HUD tile set he has a small sword.
And in his hud settings, he set _USER_0 to this tile (a small sword in his HUD).

I use symbols in my text boxes.
It’s quite easy (everything is managed in HUD TIles and HUD settings).
 

SeaFoodAndButter

New member
dale_coop said:
No in ga r in his HUD tile set he has a small sword.
And in his hud settings, he set _USER_0 to this tile (a small sword in his HUD).

I use symbols in my text boxes.
It’s quite easy (everything is managed in HUD TIles and HUD settings).

Ok. I follow you. I see where "User_0 = 0xCD" is. I understand that if I click on any 8x8 in my HUD tiles, this will be shown in my text dialogue. I see and understand that I can assign any 8x8 tile to user 0-3 with other symbols (e.g., @ and #). Thank you for telling me which symbol refers to which user tile.

Now, this draws graphics in my text, but it doesn't draw the same graphic in the HUD.

If you look at the sword in the HUD tileset (the one Joe provided) it is a small diagonal sword. I understand this so far. However, once the text dialogue says "Here take this!" and draws the corresponding tile I chose to go with the symbol I used, the dialogue box closes and then the game draws a graphic in the in-game HUD. This graphic is NOT the same diagonal sword HUD graphic that is shown in the dialogue box. It is actually a vertical sword that is coming from the GameObject tileset.

Here are screen shots to help me ask My question better:

HERE I DETERMINE WHAT HUD TILE WILL BE DRAWN IN THE TEXT. IN THIS CASE user_0 = @, which = the diagonal SWORD.
Text HUD selection.PNG

NOW, IF I PUT THE "@" SYMBOL IN ANY TEXT DIALOGUE, THE DIAGONAL SWORD WILL BE DRAWN IN THE TEXT.
Text HUD result.PNG

Once I end the dialogue box, another graphic will be drawn in my in-game HUD. In this case you will see a funny graphic to the right of the "ZEAL" stat in my HUD. Look to the right of the 2nd face. There is a funny graphic that appears after I shut my dialogue.
Text HUD result 2.PNG

This is because I did not use the exact same GameObject tileset that Joe used in his Adventure Tutorial.
Look at the tileset Joe used and look to the right, you will see a vertical sword
Hud Result 3.PNG

This vertical sword is the one being drawn in the in-game HUD, not the diagonal one in the HUD tileset.

Now look at my GameObject tileset and compare it to the funny graphic that appears in my HUD after my text dialogue.
HUD Result 4.PNG

It is easy to see that the reason I'm getting a funny graphic is because I do not have the vertical sword drawn in the same place as Joe; the funny graphic I get is actually part of my character's belly!
This is simply because my tileset is not the same as Joe's.

So, what I need to know now is 1 - How do I change the tile(s) that will ultimately be drawn in my in-game HUD (the graphic that is being pulled from my GameObject tileset) and 2 - How do I choose where this/these tiles will be drawn?

For example, after my dialogue is finished and the box is closed, how do I make a tile from my GameObject tileset appear next to the "Weapon" spot in my HUD? Look at my HUD and you will see the label "WEAPON :" this is where I want the graphic to appear.
HUD result 5.PNG


But as of right now, it appears here, as a part of my player's belly:
Text HUD result 2.PNG
 

chronosv2

New member
Check in GameEngineData\Routines\UserScripts\AdventureGame_Base\MainScripts\Adventure_PreDraw.asm.
In the tutorial he shows the code
Code:
LDA weaponsUnlocked
AND #%00000001
BEQ skipDrawingSwordInHud
DrawSprite #$74, #$14, #$2C, #%00000001, spriteOffset
	INC spriteOffset
	INC spriteOffset
	INC spriteOffset
	INC spriteOffset
skipDrawingSwordInHud:

LDA weaponsUnlocked
AND #%00000010
BEQ skipDrawingItemInHud
DrawSprite #$8C, #$14, #$29, #%00000001, spriteOffset
	INC spriteOffset
	INC spriteOffset
	INC spriteOffset
	INC spriteOffset
skipDrawingItemInHud:
If you look at the header of that file, you'll notice the definition for DrawSprite and how to use it.
Your HUD sprites are located starting at #$C0.
Use that Macro plus the location of the HUD Sprite locations to draw the icon where you want it.
Or use the graphics editor to divide the player/gameobject sprite bitmap into 8x8 chunks and use where the sword and crystal ball on the other version were used and count back/forward from there to find the sprite you need.
Edit: This might make the task of finding your sprite offset a little easier.
GameObjectTiles-Sheet.png
 

SeaFoodAndButter

New member
chronosv2 said:
Check in GameEngineData\Routines\UserScripts\AdventureGame_Base\MainScripts\Adventure_PreDraw.asm.
In the tutorial he shows the code
Code:
LDA weaponsUnlocked
AND #%00000001
BEQ skipDrawingSwordInHud
DrawSprite #$74, #$14, #$2C, #%00000001, spriteOffset
	INC spriteOffset
	INC spriteOffset
	INC spriteOffset
	INC spriteOffset
skipDrawingSwordInHud:

LDA weaponsUnlocked
AND #%00000010
BEQ skipDrawingItemInHud
DrawSprite #$8C, #$14, #$29, #%00000001, spriteOffset
	INC spriteOffset
	INC spriteOffset
	INC spriteOffset
	INC spriteOffset
skipDrawingItemInHud:
If you look at the header of that file, you'll notice the definition for DrawSprite and how to use it.
Your HUD sprites are located starting at #$C0.
Use that Macro plus the location of the HUD Sprite locations to draw the icon where you want it.
Or use the graphics editor to divide the player/gameobject sprite bitmap into 8x8 chunks and use where the sword and crystal ball on the other version were used and count back/forward from there to find the sprite you need.
Edit: This might make the task of finding your sprite offset a little easier.
GameObjectTiles-Sheet.png

Ok, so I understand the concept, I think. (You gotta be patient with me because I am a noob and I'm trying to understand.)

I need to locate where the code is being handled and that is where I need to manipulate where the graphics will be drawn and from where.
I located (I think) - what you are telling me.
HUD_MACRO.PNG

However, I'm thinking this is the code for NESMaker 4.0.11 itself and not just my particular project so I shouldn't be changing anything here, right? Shouldn't I avoid changing code to the entire NESMaker program and just change code in individual projects? But I'm not sure where to do that instead of messing with NESMaker overall.

Anyways, if you know which tutorial I could go watch where Joe goes through this I would be so thankful. I am about a 70% visual learner and I do well when I am shown by example.

Thank you for being patient with me!
 

dale_coop

Moderator
Staff member
Oh, yes, exactly a chronosv2 wrote.
You need to modify the GameEngineData\Routines\UserScripts\AdventureGame_Base\MainScripts\Adventure_PreDraw.asm to correspond your GameObjectTiles.bmp :p
 

SeaFoodAndButter

New member
@chronosv2 and @dale_coop thank you guys! I finally got it to work! I was having major issues at first because I had upgraded to 4.0.11 and was using a 4.0.6 project so some really weird stuff was happening. For example, none of the code was showing up in project settings and edit options. So I was confused to where the code was actually at. However, I reloaded my project in 4.0.6 and the code showed up. NESMaker is not really capable of allowing us to update the program and STILL use projects from previous versions.

Anyways, you two helped me do my first coding!

I do have another question. Is there are way to draw something bigger than an 8x8 box? Or is this pretty much what we have right now?
 

Attachments

  • RustyDagger.PNG
    RustyDagger.PNG
    19.8 KB · Views: 2,932

chronosv2

New member
You've got to draw all the sprites manually like the HandleSpritePreDraw code does it. You've already got the code for drawing two, so you'd just need to use a little math to get the starting pixel of the rest of the components. Remember that each sprite you draw takes one from the system's max of 64 though.
 
Top Bottom