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

Steigede
Posts: 5
Joined: Wed Feb 06, 2019 1:11 pm

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

Post by Steigede » Fri Feb 08, 2019 7:17 pm

I don't have In your "Use Sprite Based Weapon" in my "Project Settings > Script Settings". Any idea?
User avatar
dale_coop
Posts: 3486
Joined: Fri Feb 16, 2018 7:05 am
Location: France

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

Post by dale_coop » Sat Feb 09, 2019 1:05 am

It might another name depending of the module used... Might be named “sprite based weapon” or “handle sprite weapon” or something like that.

Update: confirmed, in the adventure module, it is labeled "Handle Sprite Weapon" in the "Project Settings > Script Settings".
-----
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)
User avatar
Craigery
Posts: 30
Joined: Mon Apr 30, 2018 8:53 pm

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

Post by Craigery » Mon Feb 11, 2019 3:06 am

Dale, how does the Monster Object get destroyed? There is a line in HandleSpriteWeapon.asm which included a DeactivateCurrentObject on the monster object, but we remove that. So how does it get destroyed here?
User avatar
dale_coop
Posts: 3486
Joined: Fri Feb 16, 2018 7:05 am
Location: France

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

Post by dale_coop » Mon Feb 11, 2019 4:52 am

Craigery... when the melee weapon was a sprite.. all the code for collision with a monster was in the HandleSpriteWeapon.asm script.
Now that the weapon is a real object, it follows the rules of object collisions (HandleObjectCollisions.asm script) and in that script, when a "player weapon" type object collides with a "monster" type object, the Handle Monster Hurt script is executed.
So, in that script, your monster will be destroyed (cf. your HandleHurtMonster.asm script you will find the DeactivateCurrentObject that is used now).
-----
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)
User avatar
drexegar
Posts: 222
Joined: Wed Mar 21, 2018 12:33 pm

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

Post by drexegar » Tue Feb 12, 2019 4:26 am

Thank you. I spent far too long messing with the create object code, (the stop player action doesn't work and the offset doesn't work) so I just follow your tutorial and it works great in the scrolling platform!
User avatar
dale_coop
Posts: 3486
Joined: Fri Feb 16, 2018 7:05 am
Location: France

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

Post by dale_coop » Tue Feb 12, 2019 8:46 am

Glad you made it :)
-----
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)
angelcrusher
Posts: 7
Joined: Thu Feb 14, 2019 4:50 am

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

Post by angelcrusher » Thu Feb 14, 2019 4:55 am

Hi everyone! Thanks for all of the tips. I'm using these scripts in a side scrolling platformer and everything works great with the PreDraw tweaks, but once I insert objects into my screen they are pulled towards my player when running the activate melee script. Seems to only happen when running the PreDraw tweaks for having the object follow the player in mid movement/air.

Has you seen this?

I've tried with monsters and with power-up objects and messed around with the code for a little bit. I'm just not so great with assembly since I just started learning.
User avatar
dale_coop
Posts: 3486
Joined: Fri Feb 16, 2018 7:05 am
Location: France

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

Post by dale_coop » Thu Feb 14, 2019 2:58 pm

angelcrusher wrote:
Thu Feb 14, 2019 4:55 am
Hi everyone! Thanks for all of the tips. I'm using these scripts in a side scrolling platformer and everything works great with the PreDraw tweaks, but once I insert objects into my screen they are pulled towards my player when running the activate melee script. Seems to only happen when running the PreDraw tweaks for having the object follow the player in mid movement/air.

Has you seen this?

I've tried with monsters and with power-up objects and messed around with the code for a little bit. I'm just not so great with assembly since I just started learning.
Hey angelcrusher, I think the PreDraw code proposed by Nate might be working for the particular case of Nate's project, but it's really useable as it.
I would suggest you to remove that part if your added it. And just set a timer to "DestroyMe" for your Player's Weapon for the Action Step 0 like specified in the original post.... until a more appropriate parenting code (weapon following the player) with a tutorial is made.
-----
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)
angelcrusher
Posts: 7
Joined: Thu Feb 14, 2019 4:50 am

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

Post by angelcrusher » Fri Feb 15, 2019 2:05 am

Got it thanks!
User avatar
Oracle
Posts: 11
Joined: Thu Dec 13, 2018 12:21 am

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

Post by Oracle » Sat Feb 23, 2019 1:01 pm

I think I got SuperNatetendo's code to kinda work (for me, at least). There are some strange issues connected to player death (specifically being killed by monsters) for some reason, but so far things are looking good up until then. I should mention that my weapon has 2 action states, though - and that part of the code that checks for it being in the 00 state is what got the script to stop jockeying monsters on top of me whenever I entered the room. Even so, it appears sometimes they can still latch on to you, but it:
1.) is much less common,
2.) is only temporary, and
3.) only occurs in very specific circumstances (using the melee attack right in-between 2 screens, I think - which likely has a simple solution that I am unaware of).
Anyways, here's what I could patch together:

Code: Select all

;; Nate's now slightly less-janky object parenting w/ melee weapon

    GetCurrentActionType player1_weapon 	;; Checking if the weapon is in action type 00...
    CMP #$00
    BEQ +++						;; If so, skip this whole business...
    
    LDX player1_object
   
    LDA Object_animation_frame,x
    STA temp
    
    LDA Object_movement,x
    AND #%00000111
    STA temp3
    TAY

    CLC
    CMP #$04 	;;If it if four or greater, you are facing right. (Some code taken from Dieting Hippo's melee script, checks which direction you are facing and draws the sprite accordingly)
    BCS + 		;; if carry flag is set, jump to our nameless label
    LDA Object_x_hi,x
    SEC
    SBC #$00	;; width of melee weapon (Right offset)
    JMP ++		; skip doing the left stuff
+
    LDA Object_x_hi,x
    SEC
    SBC #$1F	;; width of melee weapon (Left offset)
++
    CLC
    ADC weaponOffsetTableX,y
    STA temp1
    
    LDA Object_y_hi,x    
    CLC
    ADC weaponOffsetTableY,y
    SEC
    SBC #$08 ;; height of melee weapon
    STA temp2
    
    LDX player1_weapon
    LDA temp1
    STA Object_x_hi,x
    LDA temp2
    STA Object_y_hi,x
    
    LDA Object_movement,x
    ORA temp3
    STA Object_movement,x
+++
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
Post Reply