[4.1] Use the real Melee object weapon in the Platformer module

rimoJO

Member
...What hex-number-code-digit-converter-adapter-file plugin? I don't see one. Not in NESM, nor in the NESM folder. And I'm really bad with hex.














???
 

WillElm

New member
dale_coop said:
11/ Last thing, you should do a small modification in your StartMovingPlayerxxx script, just moving the "++" from before the "FaceDirection" line, to AFTER "FaceDirection" line.
For exemple, StartMovingPlayerRight.Asm should be like this :
Code:
 ;;;;; START MOVING PLAYER RIGHT:
 ;;;;; We will use this when the right button is pressed.
 ;;;;; If we are already showing the walking animation, which is for this module
 ;;;;; action step 1, we will skip changing to the walking state.
    LDX player1_object
    GetCurrentActionType player1_object
    CMP #$02 ;; if the state is invincible
    BEQ ++ ; skip movement if attacking
    CMP #$03
    BEQ ++ ;skip if we are casting spell
    CMP #$01
    BEQ + ;; if the action type already equals 1, jump forward
    ChangeObjectState #$01, #$04
+
;;;;;; Then, we will begin moving.
    StartMoving player1_object, MOVE_RIGHT
;;;;;; Lastly, we will change the facing direction.
    FaceDirection player1_object, FACE_RIGHT
++
    RTS

VoilĂ , your Melee weapon should work as expected...


Note: you should get rid of your GetSword pickup object, make it a health pickup or anything else you want (change the script assign to the "Power Up 00" in the "Project Settings > Script Settings").


When I implement this movement code, I can't move after jumping straight up in the air, and sometimes cannot move upon landing. Anyone else have this issue? I don't wanna go back to the original movement code because of attack spamming.
 

rimoJO

Member
Well, one: the script WAS that. I checked to make sure. and 2: it's more like a projectile, but not. It's more like DR's Red Buster, where it's a wave that goes across the screen. It's 8 tiles wide and 2 tiles tall. Is that bad? I don't think projectiles/busters/the thing that I made is supported in platformer...
 

dale_coop

Moderator
Staff member
rimoJO said:
...What hex-number-code-digit-converter-adapter-file plugin? I don't see one. Not in NESM, nor in the NESM folder. And I'm really bad with hex.

???

In the plugins foler.
Else don't use hex... just use numeric (for 16 --> #16 is numeric value --> #$10 is hex value)
 

rimoJO

Member
...
Is there any way to have a projectile in a platform game? I watched the tutorial but it was for the old NESM version. The game also wouldn't export. Maybe I used the wrong script...? (a_create_projectile)... I also tried searching it, but it said that "projectile platform" is too commonly used.
???
 

WillElm

New member
rimoJO said:
...
Is there any way to have a projectile in a platform game? I watched the tutorial but it was for the old NESM version. The game also wouldn't export. Maybe I used the wrong script...? (a_create_projectile)... I also tried searching it, but it said that "projectile platform" is too commonly used.
???

Right now I'm doing this by using this melee script, the only difference is that I have the object the melee script creates use the Shoot Forward AI action, which in turn creates the projectile.

I'm sure there's a simpler way but this works. I have it affected by gravity, so it's like a secondary throw holy water attack. You could probably have it shoot straight if you have the projectile ignore gravity, which might require you to change some things.

The fix ignore gravity thread: http://nesmakers.com/viewtopic.php?f=35&t=1939&p=13785&hilit=ignore+gravity#p13785
 

dale_coop

Moderator
Staff member
WillElm said:
rimoJO said:
...
Is there any way to have a projectile in a platform game? I watched the tutorial but it was for the old NESM version. The game also wouldn't export. Maybe I used the wrong script...? (a_create_projectile)... I also tried searching it, but it said that "projectile platform" is too commonly used.
???

Right now I'm doing this by using this melee script, the only difference is that I have the object the melee script creates use the Shoot Forward AI action, which in turn creates the projectile.

I'm sure there's a simpler way but this works. I have it affected by gravity, so it's like a secondary throw holy water attack. You could probably have it shoot straight if you have the projectile ignore gravity, which might require you to change some things.

The fix ignore gravity thread: http://nesmakers.com/viewtopic.php?f=35&t=1939&p=13785&hilit=ignore+gravity#p13785


Another solution is to follow the "[4.1] Projectiles in the platform module" tutorial from here: http://nesmakers.com/viewtopic.php?f=35&t=1703
 

rimoJO

Member
thanks, dale! I tried to find that because for some reason, I knew it existed- but it wouldn't let me...
 

rimoJO

Member
The offset broke even more and now the character gets thrown to the left whenever I press S...
welp.
I tried, I guess.
EDIT: I actually just had both the proj. and melee scripts set to B :|
EDIT: I decided to try making it melee and setting its 0th action step to shoot forward. But the offset is off. ???
 

Yokimato

New member
In case this helps anyone...

I was attempting to use Oracle's adjustment on Nate's contribution but it too was not working for me.

After some debugging, I found the problem was related to Oracle's reference to `player1_weapon` versus Nate's #OBJECT_PLAYER_MELEE. Since the latter was just the index of the game object used to create the melee object, it was *not* the right value to use for loading into the X register to then adjust the movement on it. However my debugging showed me that player1_weapon was not the value I expected to be and realized it was never actually set!

I adjusted the create melee script (triggered of the b button) to store the newly created object to player1_weapon and that worked as expected.

Code:
;(omitted rest)
CreateObject temp, temp1, #OBJECT_PLAYER_MELEE, #$00, temp3
    
meleeCreated:
    ;;;; x is now the newly created object's x.
    STX player1_weapon ; <---- Actually store the object at player1_weapon for later reference
    LDA Object_movement,x
    ORA temp2
    STA Object_movement,x
 
 PlaySound #SND_ATTACK
 ; (omitted rest)

It's also worth noting that my pre-draw adjustment removes Oracle's weapon state, but I do add a check instead to the player state, since I only care about adjusting the melee if it actually exists (i.e the player is attacking). Note that my action state #$03 is attack:

Code:
    GetCurrentActionType player1_object
    CMP #$03 ; <-- Attack
    BNE done ; This label jumps passed Oracle's code
 

yellow nail

New member
Heya! I'm sorta new to nesmaker and I did everything as followed, except I got an error saying:

Routines\Basic\ModuleScripts\InputScripts\b_create_melee_weapon.asm(65):CreateObject(26): Unknown label.
demo.txt written.

Is it something I did wrong, or am I supposed to add some sort of value? I'm not sure what to do there but I'll show the line of code the error might be pointing out

CreateObject temp, temp1, #OBJECT_PLAYER_MELEE, #&00, temp3


Thanks for the help!
 

Mugi

Member
well for starters, it should be #$00, not #&00
sans that, does the #OBJECT_PLAYER_MELEE constant exist ?
 

yellow nail

New member
Mugi said:
well for starters, it should be #$00, not #&00
sans that, does the #OBJECT_PLAYER_MELEE constant exist ?


Okay so I changed the sign and tested it, didn't work but other than that. what do you mean by constant, Did I miss a step?
 

dale_coop

Moderator
Staff member
Which version of NESmaker are you? 4.1.5? What module are you using? Platformer? Adventure?
For the "OBJECT_PLAYER_MELEE" constant... check the 1/ of my tutorial.
 

yellow nail

New member
dale_coop said:
Which version of NESmaker are you? 4.1.5? What module are you using? Platformer? Adventure?
For the "OBJECT_PLAYER_MELEE" constant... check the 1/ of my tutorial.

I'm on version 4.1.5, and i tried being a little sneaky using the platformer module assuming it'll be the same thing as the scrolling platformer module, but I have a slight feeling that it might not be the same.




Edit: Turns out the "enable" button wasn't clicked enough times, sorry for causing trouble ~.~


Also thanks!
 

dale_coop

Moderator
Staff member
No problem, yellow nail... The Simple Platformer module is very close from the Scrolling Plaformer one. You can use the same scripts, same fixes,... ;)
 

rimoJO

Member
I've already said this before, but i think the post is lost forever, so i'll say it again:
The attack animation doesn't work.
Code:
    LDA gameHandler
    AND #%00100000
    BEQ notNPCstate_attack
    JMP doneAttacking
notNPCstate_attack:
     LDA weaponsUnlocked
     AND #%00000001
     BNE canAttack
     JMP doneAttacking
canAttack:
    LDX player1_object
    GetCurrentActionType player1_object
    CMP #$03
    BNE notAlreadyAttacking 
    JMP doneAttacking
    
notAlreadyAttacking:
    ;;; don't attack if already attacking.
    ;;; do we have to check for hurt here?
    ;;;;; Here, we WOULD create melee
    ChangeObjectState #$00, #$03
    LDA Object_movement,x
    AND #%00001111
    STA Object_movement,x
    LDA #$00
    STA Object_h_speed_hi,x
    STA Object_h_speed_lo,x
    STA Object_v_speed_hi,x
    STA Object_v_speed_lo,x

    LDA Object_x_hi,x
    STA temp
    LDA Object_y_hi,x
    STA temp1

    LDA Object_movement,x
    AND #%00000111
    STA temp2
    TAY

    LDA Object_x_hi,x
    SEC 
    SBC #$10 ;; width of melee weapon (="16" in decimal = 2 tiles) 
    STA temp
    LDA Object_scroll,x
    SBC #$00
    STA temp3

    LDA temp
    ;;; offset x for creation
    CLC
    ADC weaponOffsetTableX,y
    STA temp
    LDA temp3
    ADC #$00
    STA temp3

    LDA Object_y_hi,x
    CLC
    ADC weaponOffsetTableY,y
    SEC
    SBC #$10 ;; height of melee weapon (1 tile)
    STA temp1   
    
    CreateObject temp, temp1, #OBJECT_PLAYER_MELEE, #$00, temp3
    
meleeCreated:
    ;;;; x is now the newly created object's x.
    LDA Object_movement,x
    ORA temp2
    STA Object_movement,x
    
    ;;;    PlaySound #sfx_slash
    
doneAttacking:
    RTS
 

CGdfc

New member
Does anyone know how to change weapons? for example by pressing select button change from melee to projectile and vice versa.

Dale's two tutorials work very very well (melee and projectile on platforms) but both I want to use B button (A is for jump).
when I press button B it makes the 2 attack at the same time (logical)

I have also noticed that the projectile is always active, it does not matter if unlock or not in Project INFO

any ideas?
 
I've implemented dale's script for Melee, Everything works, but the melee weapon stays in place while moving the player object. I've then added Nate's preDraw code, and that works mostly fine, but it causes two glitches :

1-If I press 'b' to strike with my melee weapon, and then quickly walk the other way with my player, the weapon reappears on the front side of my character with the weapon facing correctly forward, EXCEPT when I'm facing LEFT, then move to the RIGHT : then my weapon DOES appear in front of the player object, but the weapon is facing the wrong direction.
M0rfbE8.gif


2- If I enter a screen when I had put monsters. The 1st monster I placed in, wherever I placed it, is going to be drawn instead right in front of my player object, where my melee weapon is supposed to appear if I press B. and the monster follows my player movement, as if it was the melee object. This only happens when Nate's predraw scrip is added. it doesn't do that when I only have Dale's melee script.
8xhN3e1.gif



I want to implement crouch at some point, I feel like melee is gonna be a pain with that too. Any idea how to fix these issues or if there's newer Melee solutions I haven't seen when searching the forums ?
 
I still haven't found what is causing the first monster in a screen to be drawn right aside from the payer when I enter the screen. it seems to happen only with the predraw script on. I'm using the simple platformer module. I feel like there's a variable of some kind that is loaded for the weapon in the pre draw script, and it's stored as the same variable used in the monster drawing routine ?

Also, if I want the weapon to still appear when it hits a monster, is there an option I need to check in my melee object details ?
 
Top Bottom