[4.1] Adding Ammo system (charging weapon) for your projectiles in the Platformer module

Gilbertmaxter
Posts: 98
Joined: Tue Oct 16, 2018 3:04 am

Re: [4.1] Adding Ammo system (charging weapon) for your projectiles in the Platformer module

Post by Gilbertmaxter » Mon Mar 04, 2019 6:27 pm

Thank you dale will use this as i am getting the same thing to happen still :)
User avatar
Convoy_Avenger
Posts: 100
Joined: Tue Aug 14, 2018 1:42 am

Re: [4.1] Adding Ammo system (charging weapon) for your projectiles in the Platformer module

Post by Convoy_Avenger » Sat Mar 09, 2019 12:45 am

Hey Dale, if I wanted to use 2 different types of ammo, that shot the type of the last item I picked up, any ideas how I could make that work? I'm messing with the projectile script now, but doesn't seem to be as easy as just doubling everything up. Will probably need to do a CMP to what ammo I currently have loaded? Then fire and decrease that variable. How I do that in ASM though is totally lost on me... I'll try a few things.

EDIT: Again. I actually DID just double up on everything.. literally everything. Duplicated the ammo script, doubled all the variables and pickups, and just had to change all the Var names and that seems to have done it.
going2maine
Posts: 14
Joined: Fri Mar 29, 2019 12:51 am

Re: [4.1] Adding Ammo system (charging weapon) for your projectiles in the Platformer module

Post by going2maine » Tue Apr 16, 2019 5:55 am

I've adapted this to the Adventure module, but I'm having one oddity. If I display my ammo in the HUD as a number, everything works fine. But if I try to display it as Var Tiles, something weird happens. Let's say I have the max of both the ammo and the player health set to 5, and both are at their max. If the player gets hurt, dropping its health value to 4, when I move to a different screen the HUD shows 4 for both the health and the ammo. But the variable for the ammo is still 5.
User avatar
dale_coop
Posts: 3956
Joined: Fri Feb 16, 2018 7:05 am
Location: France

Re: [4.1] Adding Ammo system (charging weapon) for your projectiles in the Platformer module

Post by dale_coop » Tue Apr 16, 2019 8:39 am

I could be wrong... but, I think every HUD variables displayed as Var Tiles would have this bug (except myHealth)... because there is specifically a code for myhealth hardcoded in the handle hud var tiles script... :p
So yep, I think you are right.
Take a look at this topic: viewtopic.php?f=60&t=2466
-----
Sorry about my poor english
All I need: A Damn Fine Cup of Coffee
My games: PRESS START GAME / UNDERGROUND ADVENTURE / UNDERGROUND ADVENTURE (Arcade version - Byte-Off-2019)
going2maine
Posts: 14
Joined: Fri Mar 29, 2019 12:51 am

Re: [4.1] Adding Ammo system (charging weapon) for your projectiles in the Platformer module

Post by going2maine » Tue Apr 16, 2019 12:48 pm

Nice. That seems to have mostly fixed it. When I change screens it works normally. Now to figure out why when I shoot, it completely zeroes out the tiles, then only redraws them when the charging timer hits.

I feel like I spend more time battling with bugs and hardcoded values with Nesmaker than actual programming...
User avatar
dale_coop
Posts: 3956
Joined: Fri Feb 16, 2018 7:05 am
Location: France

Re: [4.1] Adding Ammo system (charging weapon) for your projectiles in the Platformer module

Post by dale_coop » Tue Apr 16, 2019 1:16 pm

going2maine wrote:
Tue Apr 16, 2019 12:48 pm
I feel like I spend more time battling with bugs and hardcoded values with Nesmaker than actual programming...
Yeah, I know what you mean...
-----
Sorry about my poor english
All I need: A Damn Fine Cup of Coffee
My games: PRESS START GAME / UNDERGROUND ADVENTURE / UNDERGROUND ADVENTURE (Arcade version - Byte-Off-2019)
going2maine
Posts: 14
Joined: Fri Mar 29, 2019 12:51 am

Re: [4.1] Adding Ammo system (charging weapon) for your projectiles in the Platformer module

Post by going2maine » Wed Apr 17, 2019 12:09 am

I figured it out. I was just calling UpdateHud HUD_myAmmo. I should have been calling:

Code: Select all

	LDA myAmmo	
	STA hudElementTilesToLoad	
	UpdateHud HUD_myAmmo
Post Reply