Boomerang Like Projectile [Platformer]

Hey all!
I've been poking around with NESmaker, particularly with the Platformer Module. In my rough ideas for my game, I had the idea for a throwable projectile that would return to the projectile source on the player when thrown, and until it had, the player could not access another ability.
I cant program ASM if I wanted to, and was wondering if anyone would be up to the challenge.
thanks!
 

jorotroid

Member
I am working on a boomerang. Back when 4.0.0 came out, I started by writing an AI script, but I couldn't find a way to get the AI script to be called every frame which is what would be needed for what I am going for. The easiest thing you could do is have an AI script that tells the projectile to switch directions, and have that set to a timer. This will give a boomerang effect similar to the Cross in Castlevania. If you want something more advanced that actually follows the player like the batarang in Batman or the big throwing star in the Ninja Gaiden games, then some more fancy assembly coding will be required. I'll share what I come up with, but I have no ETA when I will get around to it.
 
jorotroid said:
I am working on a boomerang. Back when 4.0.0 came out, I started by writing an AI script, but I couldn't find a way to get the AI script to be called every frame which is what would be needed for what I am going for. The easiest thing you could do is have an AI script that tells the projectile to switch directions, and have that set to a timer. This will give a boomerang effect similar to the Cross in Castlevania. If you want something more advanced that actually follows the player like the batarang in Batman or the big throwing star in the Ninja Gaiden games, then some more fancy assembly coding will be required. I'll share what I come up with, but I have no ETA when I will get around to it.

It would be sloppy and iffy looking as far a quality, but you could have it do its arch and then if it isnt touching the player projectile source, do something along the lines of (This isnt in asm obviously, but just as far as functionality is concerned):
Code:
if playerProjectileX > x then
	x = x + 1
elseif playerProjectileX < x then
	x = x - 1
end
if playerProjectileY > y then
	y = y + 1
elseif playerProjectileY < y then
	y = y - 1
end
Thanks for your solution as well. Unable to test it out myself right now as I don't have access to my machine ATM, but I will give it a try when I get the chance.
 

dale_coop

Moderator
Staff member
An simple boomerang, using native functionalities of NESMaker (without coding)

1lJ6RTH.gif

The projectile goes then comes back (and destroy itself at origin point), it will destroy itself on collisions.

In the "Scripts settings", in the "Project Settings" tab:
- select the unused "AI Action 10" and assign it to the "Routines\System\AI_Reactions\Reaction_01.asm" script (the "REVERSE DIRECTION" action script).
- select the unused "AI Action 11" and assign it to the "Routines\System\AI_Reactions\Reaction_02.asm" script (the "DESTROY ME" action script).
In the "Project labels" tab, for "Action types":
- rename "AI_Behavior10" to "10 - Reverse direction"
- rename "AI_Behavior11" to "11 - Destroy Me"

Then, for the boomerang (projectile) game object, in its "Object details", as usual set animations, "player weapon", "speed" and "acceleration" and "Destroy me" for Edge and Solid object reaction.

Now, go to "Actions" and set:
- action step "0", action as "0-Null", a "Timer" value of "2", a "Animation speed" of "4" and a "End of action" as "Advance":
Action_step_0.png


- action step "1", action as "10 - Reverse direction", a "Timer" value of "2", a "Animation speed" of "4" and a "End of action" as "Advance":
Action_step_1.png


- action step "2", action as "11 - Destroy Me", a "Timer" value of "0", a "Animation speed" of "0" and a "End of action" as "GoToFirst":
Action_step_2.png


And voilà... a simple boomerang projectile.
 
dale_coop said:
An simple boomerang, using native functionalities of NESMaker (without coding)

1lJ6RTH.gif

The projectile goes then comes back (and destroy itself at origin point), it will destroy itself on collisions.

In the "Scripts settings", in the "Project Settings" tab:
- select the unused "AI Action 10" and assign it to the "Routines\System\AI_Reactions\Reaction_01.asm" script (the "REVERSE DIRECTION" action script).
- select the unused "AI Action 11" and assign it to the "Routines\System\AI_Reactions\Reaction_02.asm" script (the "DESTROY ME" action script).
In the "Project labels" tab, for "Action types":
- rename "AI_Behavior10" to "10 - Reverse direction"
- rename "AI_Behavior11" to "11 - Destroy Me"

Then, for the boomerang (projectile) game object, in its "Object details", as usual set animations, "player weapon", "speed" and "acceleration" and "Destroy me" for Edge and Solid object reaction.

Now, go to "Actions" and set:
- action step "0", action as "0-Null", a "Timer" value of "2", a "Animation speed" of "4" and a "End of action" as "Advance":
Action_step_0.png


- action step "1", action as "10 - Reverse direction", a "Timer" value of "2", a "Animation speed" of "4" and a "End of action" as "Advance":
Action_step_1.png


- action step "2", action as "11 - Destroy Me", a "Timer" value of "0", a "Animation speed" of "0" and a "End of action" as "GoToFirst":
Action_step_2.png


And voilà... a simple boomerang projectile.

Hey, thanks! I appreciate it. However, when compiling I get this error... and I'm not sure how to fix it.

Code:
C:\(Filepath)\nesmaker_4_0_11_platformula\NESmaker_4_0_11_Platformula\GameEngineData>asm6 MainASM.nes game.nes demo.txt
pass 1..
pass 2..
last try..
Routines\System\Vectors.asm(1): Value out of range.
demo.txt written.

C:\(Filepath)\nesmaker_4_0_11_platformula\NESmaker_4_0_11_Platformula\GameEngineData>pause
Press any key to continue . . .

In the platformer tutorial, they showed how to fix this. but this seems to be an error in the base engine code.
 

dale_coop

Moderator
Staff member
This error is just a memory issue (lack of memory).
Not enough space so some part of the code are cut (Si not found anymore).

You might have either to much scripts added in the « input scripts » or in « scripts settings » or too much items displayed on your HUD? Or maybe you made a lot of modifications in the scripts?

It will be fixed in the next release (Joe made some clean up)
 
dale_coop said:
This error is just a memory issue (lack of memory).
Not enough space so some part of the code are cut (Si not found anymore).

You might have either to much scripts added in the « input scripts » or in « scripts settings » or too much items displayed on your HUD? Or maybe you made a lot of modifications in the scripts?

It will be fixed in the next release (Joe made some clean up)
Ah ok. Makes sense. Just for reference, what percent of the platformula code do you think could be optimized?
As for what I've done, just the basic platform scripts and whatnot, and some graphics as well as levels. I haven't changed anything in the scripts except in the shoot to fix an error (renaming sfx_shoot to SFX_SHOOT, what my project uses)
 

dale_coop

Moderator
Staff member
In the next release, I think A LOT will be optimized.
For your current problem, if you didn't make a lot of modifications, maybe you put too much elements on your HUD?
What about your "Scripts > Input Scripts" (the small folder icon in the tree view)? did you attached any script that you are not using in the "Input Editor"? If you did, remove them. It will free up some space.
 
dale_coop said:
In the next release, I think A LOT will be optimized.
For your current problem, if you didn't make a lot of modifications, maybe you put too much elements on your HUD?
What about your "Scripts > Input Scripts" (the small folder icon in the tree view)? did you attached any script that you are not using in the "Input Editor"? If you did, remove them. It will free up some space.
Well, now that I think about it, it might be that I'm using the last slots on the HUD editor for my HUD. There is still free spots, but I put them there. Good to hear about the optimization as well.
 

strawmancomics

New member
What do I need to do to get the boomerang to pick up an object? I've tried making a custom tile type that allows for prize pick up that's not the player. It turns the object solid but my boomerang wont pick it up.

I've also tried editing the prize_PlatformBase.asm from +isPlayer Branch to +isWeapon. It didn't seem to change anything. Preferably I'd like the melee object and the player to pick up the item.
 

smilehero65

Active member
What do I need to do to get the boomerang to pick up an object? I've tried making a custom tile type that allows for prize pick up that's not the player. It turns the object solid but my boomerang wont pick it up.

I've also tried editing the prize_PlatformBase.asm from +isPlayer Branch to +isWeapon. It didn't seem to change anything. Preferably I'd like the melee object and the player to pick up the item.
Try to use this thread as a basis:

 
Top Bottom