Need help with a "Movable Monster" type I made

tbizzle

Well-known member
So I have created a monster type that will act as a movable block. So far all it has is a AI script that is basically a recoil script. When you hit it with your weapon it will recoil in the opposite direction. I have made a check in the player hurt script so the player will not get hurt by this movable block/monster type. Right now all I can do is walk directly through the block. I'd like it to check the Players object flag for when the player and this monster block collide, the block will recoil just like when it collides with a player weapon. I'm close and I on the right track. I just need someone to point my in the right direction to make this possible. I should probably add that I have also made a check to make the monster invincible.

 

smilehero65

Active member
So I have created a monster type that will act as a movable block. So far all it has is a AI script that is basically a recoil script. When you hit it with your weapon it will recoil in the opposite direction. I have made a check in the player hurt script so the player will not get hurt by this movable block/monster type. Right now all I can do is walk directly through the block. I'd like it to check the Players object flag for when the player and this monster block collide, the block will recoil just like when it collides with a player weapon. I'm close and I on the right track. I just need someone to point my in the right direction to make this possible. I should probably add that I have also made a check to make the monster invincible.

Personally, I would recommend that instead of a monster it would be another object type.
After all, the target type flag in the Object Details in unused;)

Then in the Handle Object Collision script, you could add a new interaction between the player and the "target type"
 

tbizzle

Well-known member
I'm Already using Target Type for my "bomb", so it doesn't get messed up by all the other code that limits other weapons.
 

smilehero65

Active member
So I have created a monster type that will act as a movable block. So far all it has is a AI script that is basically a recoil script. When you hit it with your weapon it will recoil in the opposite direction. I have made a check in the player hurt script so the player will not get hurt by this movable block/monster type. Right now all I can do is walk directly through the block. I'd like it to check the Players object flag for when the player and this monster block collide, the block will recoil just like when it collides with a player weapon. I'm close and I on the right track. I just need someone to point my in the right direction to make this possible. I should probably add that I have also made a check to make the monster invincible.

Btw @tbizzle, are u using the standard HUD on the bottom of the screen???
I thought that was not possiblešŸ¤£šŸ¤£ (maybe I assumed that if it wasn't possible in 4.1.5 scrolling, then in the other modules either)
 

SHLIM

Active member
mark it as a monster or npc then in the object collision script just do a check (inside the npc or monster part) for that object type, then exectute the move code there. If its not the object type then skip to the regular collision code
 

DarthAT

Member
@tbizzle I posted about this same thing this morning, expressing my frustrations with a movable block

Frustration..

I have been thinking about this for months and have thought about the same thing you have come up with, making it a monster and pushing it.

I am very limited in my knowledge of ASM, would you mind sharing with me what you have so far? I would love to work on this with you and learn.

Thanks.
 

tbizzle

Well-known member
@DarthAT I'm still just poking at it also. Some things I have been playing with at the moment are: Player invincibility. Here I set a check at the beginning of the "Hurt Player" script to ignore monster/player collisions when "UserScreenBytes" is set to "1".

Code:
            LDA userScreenByte5
            CMP #$01
            BNE nextOne67
            JMP +skipHurt
            nextOne67:

Another thing I have been playing with is Monster Invincibility. Here I have set a check using "Monster Bits" at the beginning of the "Hurt Monster" script.

Code:
   LDY Object_type,x
   LDA MonsterBits,y
   AND #%00000001 ;;;;This bit is the top "check box/bit" for monster bits
   BEQ poot5
   JSR doWaitFrame
   RTS
       poot5:

Then for the "Movable Monster Block's" AI script I have some "recoil" asm I am using so it can react to collision.

Code:
 LDA Object_x_hi,x
        CLC
        ADC other_center_x
        STA tempA
        LDA Object_y_hi,x
        CLC
        ADC other_center_y
        STA tempB
        TXA
        PHA
            LDX selfObject
            LDA Object_x_hi,x
            CLC
            ADC self_center_x
            STA tempC
            LDA Object_y_hi,x
            CLC
            ADC self_center_y
            STA tempD
        PLA
        TAX
   
        ;;; RECOIL
        ;;; find the center.
        LDA tempA
        SEC
        SBC tempC
        bpl +gotAbs ;; if positive, this is abs value
        EOR #$FF
            CLC
            ADC #$01
        +gotAbs
            STA temp
           
        LDA tempB
        SEC
        SBC tempD
        bpl +gotAbs
        EOR #$FF
            CLC
            ADC #$01
        +gotAbs
            ;;; now abs of y is in A
            CMP temp
            BCC +recoilHor
                ;; recoil vert
                LDA tempB
                CMP tempD
                BCS +recoilDown
                    LDA Object_direction,x
                    AND #%00001111
                    ORA #%00100000
                    STA Object_direction,x
                    JMP +continue
                +recoilDown
                    LDA Object_direction,x
                    AND #%00001111
                    ORA #%00110000
                    STA Object_direction,x
                    JMP +continue
            +recoilHor
                LDA tempA
                CMP tempC
                BCS +recoilRight
                    LDA Object_direction,x
                    AND #%00001111
                    ORA #%10000000
                    STA Object_direction,x
                    JMP +continue

                +recoilRight
                    LDA Object_direction,x
                    AND #%00001111
                    ORA #%11000000
                    STA Object_direction,x

After this I guess somehow "Handle Objects" is will be the next destination for some type of ASM to added to make the Player Object and the Movable Monster Block observe a collison that makes the block move and all the while the player not get hurt whilst doing so.
 
Top Bottom