Projectile is affected by gravity or get stucked[4.1]

ItchyGames

New member
Hi There,
the problem I'm facing with projectiles is the following:

1) if I set the projectile with the flag Ignore Gravity enabled, it does not move where is created.
2) Else, it will add gravity force to it, so the projectile does not go straight.
3) The Screen where I'm doing the tests have the Physics enabled.

This is the code I'm using to create projectiles
Code:
CreateSimpleProjectileWithMotion:
    LDY player1_object
    CPY #$FF ;; if the player object is set to ff, he's dead.
    BNE playerCanCreateProjectile
    RTS
playerCanCreateProjectile:
    ;; get offset
    ;; in a later version, we will use user defined offsets.
    ;; for now, we'll place projectile creation at center of object
    LDA Object_movement,y
    AND #%00000111
    TAX
    LDA weaponOffsetTableX,x
    ;;; now we have the offset
     CLC
     ADC Object_x_hi,y
    STA temp1
    LDA weaponOffsetTableY,x
    CLC
    ADC Object_y_hi,y
    STA temp2
    
    LDA Object_scroll,x
    STA temp3
    
    CreateObject temp1, temp2, #$02, #$00, temp3  ;; <<== Create a Game Object 01 (=Melee)
    LDA Object_movement,y
    AND #%00000111
    STA temp
    TAY
    LDA DirectionMovementTable,y
    ORA temp

    STA Object_movement,x

    ;; add object size offset.
    LDA Object_x_hi,x
    SEC
    SBC #$08 ;; half of the width of the intended projectile
    STA Object_x_hi,x
    LDA Object_y_hi,x
    SEC
    SBC #$08 ;; half of the height of the intended projectile
    STA Object_y_hi,x

    ;;PlaySound #$00, #$00
    RTS

Any help will be welcomed.
 

dale_coop

Moderator
Staff member
Same here: http://nesmakers.com/viewtopic.php?f=22&t=1684
I hope someone will figure out how to make it work again... (or maybe I will find time to diggin' myself in that problem :p)
 

Mugi

Member
did you try the new "use aimed physics" flag ?
this made my character randomly move in horizontal axis when set, i believe this flag is actually meant for projectiles, as it makes them ignore gravity and use an alternate physics set to go straight.
(this was called "use alternate physics" in 4.0.11, i dont think it actually did anything there though.)
 

dale_coop

Moderator
Staff member
In the 4.0.11 the "use alternate physics" was made (and used) only for monsters action "shoot at player" (that had a very particular behavior, specific code that didn't following the classic physics codes)
So if it's the same flag... the projectile will just fall down and go to the left of the screen.
 

dale_coop

Moderator
Staff member
I think the "ignore gravity" flag deactivate all movements (horizontaly and verticaly). This might be reason the projectile object doesn't move when this flag is set.
 

dale_coop

Moderator
Staff member
I think I found a fix/workaround for the projectile...

Shoot.gif
 

dale_coop

Moderator
Staff member
I will make a small topic for that... (but still have interrogations about the code... I will do some tests before posting)
 
Top Bottom