NESmaker 4.5 - Adventure Game Basics - Part 11: Sprite Huds and jumpthrough platforms

Rob Burrito

New member
to make your projectiles count down as they do in the tutorial, after adding the line of script to add ammo to the sprite hud you have to go your project hierarchy Scripts\Input scripts\Base4_5\Game\Mod_2WayPlatformer\Inputs\shootProjectile_scrolling and un-comment lines 5,6,7,8,10 for it to work as shown.

i'm also having a strange bug where if i run into the left side of my crab the game just freezes, hitting it from any other angle does what it should decreasing lives or destroying the monster from above.

also something messed with edge bounds. if you remove the solid sky blocks you can just walk left off the opening screen now, and after scrolling to the right if you walk back to the left edge you will warp to a different screen instead of stop.
 

Rob Burrito

New member
the player object edge reaction changing to null (i had set it there but must have closed the box via the windows 'x' rather than hit the "close" button) it didn't save the edge reaction setting till i went back and changed the player\object details\actions\edge reactions\null and closed the menu correctly. still having some other edge related issues, but hopefully they're getting figured out as we go.
 

dale_coop

Moderator
Staff member
YEah... about bugs, I really don't bother or... because there are several of them. By the end, of the Summer Camp, all those small issues should have been fixed.
In the mean time, you can report your issues to Joe on the FB group, he needs those feedbacks to make the patches on the next tutorials.
It's just for fun, modifying the modules, scripts... yeah, it's buggy, it's not perfect, it's the idea of that camp.
 

dale_coop

Moderator
Staff member
Something that might help with the weird collisions with monsters (it helped for me) is adding:
Code:
		LDA #$00
		STA Object_v_speed_lo,x
		STA Object_v_speed_hi,x
before the line
Code:
doneWithGravity:

In the Handle Physics script
2020-06-29-15-15-47-Z-NESmaker-4-5-Tutorial-Project-20200605-Game-Engine-Data-Routines-BASE-4-5-Game.png
 

mkjake63

Member
I'm having trouble with the ammo. It works fine but once it reaches 0 the hud refills itself instead of staying empty
 

dale_coop

Moderator
Staff member
If you have commented out (or removed) a few line in the shootProjecte_Ammo.asm script... like the line 5,6 and 7... (to keep unlimited Ammo):
Code:
	LDA myAmmo
	BNE canShoot
	JMP canNotShoot
don't forget to also comment out (or remove) the line 10 :
Code:
	DEC myAmmo

Else... could you share your script?
 

mkjake63

Member
Here's my code for shootProjectile_Scrolling

Code:
;;; Create a Projectile.
;;; Assumes that the projectile you want to create is in GameObject Slot 01.
;;; Assumes variable called myAmmo exists.
;;; assumes myAmmo is in hud element 8.
    LDA myAmmo
     BNE +canShoot
         JMP +canNotShoot
      +canShoot:
    ;; there is ammo here.
      DEC myAmmo
      ; UpdateHudElement #$03 ;; change this to which element shows myAmmo.
    TXA
    PHA
    TYA
    PHA
        LDX player1_object
        LDA Object_x_hi,x
            CLC
        ADC #$04
        STA tempA
        LDA Object_y_hi,x
            CLC
        ADC #$04
        STA tempB
        LDA Object_direction,x
        AND #%00000111
        STA tempC
        LDA Object_screen,x
        STA tempD
        CreateObjectOnScreen tempA, tempB, #$01, #$00, tempD
            ;;; x, y, object, starting action.
            ;;; and now with that object, copy the player's
            ;;; direction and start it moving that way.
            LDA tempC
            STA Object_direction,x
            TAY
            LDA DirectionTableOrdered,y
            STA temp1
            TXA
            STA temp
            StartMoving temp, temp1
    PLA
    TAY
    PLA
    TAX
+canNotShoot:
    RTS

and here's my DoDrawspriteHud code

Code:
;;; Here is an example of how to do a sprite hud.
;;; Arg5, the one that has the value of myVar, must correspond to a user variable you have in your game.
;;; Don't forget, you can only draw 8 sprites per scanline, so a sprite hud can only be 8 sprites wide max.


;DrawSpriteHud #$08, #$08, #$11, #$10, #$10, myVar, #$00
	; arg0 = starting position in pixels, x
	; arg1 = starting position in pixels, y
	; arg2 = sprite to draw, CONTAINER
	; arg3 = MAX	
	; arg4 = sprite to draw, FILLED
	; arg5 = variable.
	; arg6 = attribute
	
DrawSpriteHud #16, #16, #$1C, #$03, #$1D, myLives, #$00 ;;;Draws Health

DrawSpriteHud #16, #24, #$7F, #$05, #$0C, myAmmo, #$00 ;;;Draws Ammo
 

dale_coop

Moderator
Staff member
Those script look corrects to me.
And every time you use all your Ammo... after reaching 0 it's full again?
Or only on certain circumstances?

Maybe you have an Ammo "charge pickup" on your screen? and you shoot at it? or a monster touched it? (because I think in that situation, your Ammo would be full again)
 

mkjake63

Member
Kinda yeah, once I use all the ammo I can't shoot but the hud resets to being full despite not having ammo
 

dale_coop

Moderator
Staff member
You might have made an error somewhere else.
But where...
you could search the the "myAmmo" word in all the scripts... or try start again the tutorial fro the beginning...
 

mkjake63

Member
Yeah I think I'm gonna have to restart because I'm having a few weird issues other than that. I'll learn a bit more the second time around haha. Thanks for the help either way!
 

dale_coop

Moderator
Staff member
Got to do it twice, me too... because got some issues.
First, I'd suggest to set and do EXACTLY like Joe does in the tutorial video (same scripts, exact same settings for objects, screens ...) When all the tutorials finished, you can try customize the project.
 
Top Bottom