4.LatestVersion Projectile Problem

rimoJO

Member
So, I'm making a game, and I made a projectile in the game- more specifically, a buster/shock wave, similar to DR's Red Buster. So, basically, the character swings his sword (animation), and that works fine, but there's a problem with the actual projectile. The character always gets thrown left, unless I move right, and the projectile never spawns. And then I run into an enemy and take damage and die. ?
?
?
 

dale_coop

Moderator
Staff member
The projectile is another object?
So your b_create_melee_whatever script, creates a sword and... create a projectile? Or the projectile is created by a end of animation / action?
 

rimoJO

Member
the projectile is set to "projectile" and "projectile source", and the script is "b_create_projectile_platformer.asm" from the tutorial. for the last part, i have no idea.
 

dale_coop

Moderator
Staff member
For the offset off... follow again the tutorial, you can set the offset (by selecting the "Game Objects" element).
 

rimoJO

Member
I did.
EDIT: It's actually the script; the projectile is actually two tiles by two tiles. :|
EDIT: I set the offset in Game Objects and changed the projectile width and height from 08, 08 to 16, 16. Still not working. The animation is also not working...
 

dale_coop

Moderator
Staff member
Could you share the script you are using?
And a screenshot of your « Game Objects » offset settings for left / right?
And a screenshot of your Projectile action step 0.
 

rimoJO

Member
Sure!
EDIT:
Code:
    LDA gameHandler
    AND #%00100000  
    BEQ canShoot
    JMP doneShooting
canShoot:
    LDX player1_object
    ;;; IF YOU WANT TO USE AN SPECIFIC ANIMATION / ACTION STEP WHEN SHOOTING, comment out the following 3 lines: 
    ;;; check if already shooting (assuming the shoot action step is 05)
    ;GetCurrentActionType player1_object
    ;CMP #$05
    ;BNE notAlreadyShooting
    JMP wasAlreadyShooting 
notAlreadyShooting
    ;;; IF YOU WANT TO USE AN SPECIFIC ANIMATION / ACTION STEP WHEN SHOOTING, comment out the following 1 line: 
    ;;; if not already shooting, change it's action step (assuming the shoot action step is 05)
    ;ChangeObjectState #$05, #$02
    
    ;;; if you want your player stops when he's shooting, comment out the following lines:
    ;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
    
;; if was already shooting
wasAlreadyShooting:

    LDA Object_movement,x
    AND #%00000111
    STA temp2
    TAY

    LDA Object_x_hi,x
    SEC 
    SBC #$16 ;; width of projectile 
    STA temp
    LDA Object_scroll,x
    SBC #$00
    STA temp3

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

    LDA Object_y_hi,x
    CLC
    ADC projOffsetTableY,y
    sec
    sbc #$16 ;; height of projectile
    STA temp1   
    
    
    CreateObject temp, temp1, #OBJECT_PLAYER_PROJECTILE, #$00, temp3
  
    ;;;; x is now the newly created object's x.
    LDA Object_movement,x
    ORA temp2
    STA Object_movement,x
    LDY temp2
    LDA directionTable,y
    ORA Object_movement,x
    STA Object_movement,x
    
    ;PlaySound #SND_SHOOT
doneShooting:
    RTS
 

Attachments

  • Act.S. 0.PNG
    Act.S. 0.PNG
    12.6 KB · Views: 1,240
  • GO Left.PNG
    GO Left.PNG
    6.2 KB · Views: 1,240
  • GO Right.PNG
    GO Right.PNG
    6.7 KB · Views: 1,240

dale_coop

Moderator
Staff member
If your projectile is 2 tiles... in the script instead of "#$16" uses "#$10" (it's 16 in hex)... to “#16" (without the $, for decimal 16). The offset should be better.

I see you set your actin step 0 to "destroy" after a timer of "1"... if it's a projectile, I think you don't want to destroy it after the timer, right?
Else you want the projectile is destroyed when it hurt a enemy or a solid tile or the screen's edge (in the detail tab set thee "solid object reaction" and "edge object reaction" to "DestroyMe".

Check all your animations... if every frames are correctly set (not empty).
 

rimoJO

Member
Thanks!
the animation doesn't work though.
and can there be a limit to how many projectiles I can make every few seconds?
Other than that everything's looking great for me! :D
 

dale_coop

Moderator
Staff member
Which animation that is not working? The projectile's animation?
Or you have animation for the player, when he's shooting?
 

rimoJO

Member
Player animation. It's set to 3 but the script says 5 so 3 and five.
The "Attack" animation is set to 3 and 5 but it's still not working...
 

dale_coop

Moderator
Staff member
Oh ok... 5 was an example.
In the script, all those lines are commented (there is a ";" before the code... it means it isn't be executed), if you want to use animation, you need to uncomment, by removing the ";" for the lines (cf the comments).

So like this:
Code:
    LDA gameHandler
    AND #%00100000  
    BEQ canShoot
    JMP doneShooting
canShoot:
    LDX player1_object
    ;;; IF YOU WANT TO USE AN SPECIFIC ANIMATION / ACTION STEP WHEN SHOOTING, comment out the following 3 lines: 
    ;;; check if already shooting (assuming the shoot action step is 05)
    GetCurrentActionType player1_object
    CMP #$05
    BNE notAlreadyShooting
    JMP wasAlreadyShooting 
notAlreadyShooting
    ;;; IF YOU WANT TO USE AN SPECIFIC ANIMATION / ACTION STEP WHEN SHOOTING, comment out the following 1 line: 
    ;;; if not already shooting, change it's action step (assuming the shoot action step is 05)
    ChangeObjectState #$05, #$02
    
    ;;; if you want your player stops when he's shooting, comment out the following lines:
    ;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
    
;; if was already shooting
wasAlreadyShooting:

    LDA Object_movement,x
    AND #%00000111
    STA temp2
    TAY

    LDA Object_x_hi,x
    SEC 
    SBC #$16 ;; width of projectile 
    STA temp
    LDA Object_scroll,x
    SBC #$00
    STA temp3

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

    LDA Object_y_hi,x
    CLC
    ADC projOffsetTableY,y
    sec
    sbc #$16 ;; height of projectile
    STA temp1   
    
    
    CreateObject temp, temp1, #OBJECT_PLAYER_PROJECTILE, #$00, temp3
  
    ;;;; x is now the newly created object's x.
    LDA Object_movement,x
    ORA temp2
    STA Object_movement,x
    LDY temp2
    LDA directionTable,y
    ORA Object_movement,x
    STA Object_movement,x
    
    ;PlaySound #SND_SHOOT
doneShooting:
    RTS
 

rimoJO

Member
I think I'm missing something, because nothing's changed.
Code:
    LDA gameHandler
    AND #%00100000  
    BEQ canShoot
    JMP doneShooting
canShoot:
    LDX player1_object
    ;;; IF YOU WANT TO USE AN SPECIFIC ANIMATION / ACTION STEP WHEN SHOOTING, comment out the following 3 lines: 
    ;;; check if already shooting (assuming the shoot action step is 05)
    GetCurrentActionType player1_object
    CMP #$05
    BNE notAlreadyShooting
    JMP wasAlreadyShooting 
notAlreadyShooting
    ;;; IF YOU WANT TO USE AN SPECIFIC ANIMATION / ACTION STEP WHEN SHOOTING, comment out the following 1 line: 
    ;;; if not already shooting, change it's action step (assuming the shoot action step is 05)
    ChangeObjectState #$05, #$02
    
    ;;; if you want your player stops when he's shooting, comment out the following lines:
    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
    
;; if was already shooting
wasAlreadyShooting:

    LDA Object_movement,x
    AND #%00000111
    STA temp2
    TAY

    LDA Object_x_hi,x
    SEC 
    SBC #$10 ;; width of projectile 
    STA temp
    LDA Object_scroll,x
    SBC #$00
    STA temp3

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

    LDA Object_y_hi,x
    CLC
    ADC projOffsetTableY,y
    sec
    sbc #$10 ;; height of projectile
    STA temp1   
    
    
    CreateObject temp, temp1, #OBJECT_PLAYER_PROJECTILE, #$00, temp3
  
    ;;;; x is now the newly created object's x.
    LDA Object_movement,x
    ORA temp2
    STA Object_movement,x
    LDY temp2
    LDA directionTable,y
    ORA Object_movement,x
    STA Object_movement,x
    
    ;PlaySound #SND_SHOOT
doneShooting:
    RTS
 

dale_coop

Moderator
Staff member
Your player’s action step 5 is set for shooting animation ?
Else if you want to use the action step 3, replace #$05 with #$03
 

rimoJO

Member
Okay!
EDIT: It still does. not. work. Is it the character's act. page?
EDIT:
 

Attachments

  • Moki act 3.PNG
    Moki act 3.PNG
    15.5 KB · Views: 1,174
Top Bottom