Create Projectile doesn't work in platform module?

User avatar
ostincoolston
Posts: 40
Joined: Sun Apr 22, 2018 11:21 am

Re: Create Projectile doesn't work in platform module?

Post by ostincoolston » Sun Sep 09, 2018 6:04 pm

ahhh yes! I got it coming straight out of my A-Eye Bots eye now, thank you!
User avatar
dale_coop
Posts: 1294
Joined: Fri Feb 16, 2018 7:05 am
Location: France

Re: Create Projectile doesn't work in platform module?

Post by dale_coop » Sun Sep 09, 2018 6:32 pm

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
User avatar
Lord Sharpie
Posts: 3
Joined: Wed May 30, 2018 3:29 pm
Location: Austin, TX
Contact:

Re: Create Projectile doesn't work in platform module?

Post by Lord Sharpie » Sat Sep 15, 2018 3:25 am

So is there a working projectile script I could see? I know you guys in here have figured out a bunch of stuff for it, but I'm having a hard time piecing what you've done back together to make it work in my own project. Was just curious if anyone had an example of what a complete functioning projectile script looked like. The "shootweapon" script in the Platform Module goes nowhere, does nothing, and I'm getting lost trying to get it to work... I'm just trying to get a basic Mega Man-style gun working (left and right directions only, maybe a charged-shot functionality, too)...
User avatar
ildalla83
Posts: 8
Joined: Thu Sep 20, 2018 3:23 pm
Location: Italy

Re: Create Projectile doesn't work in platform module?

Post by ildalla83 » Tue Sep 25, 2018 8:14 am

I followed your suggestions in this thread, but I cannot build a correct movement for shooting with my character.
Is possible to have a simple tutorial to create a shooting character step by step?
tnx
:shock: :shock: :shock:
User avatar
dale_coop
Posts: 1294
Joined: Fri Feb 16, 2018 7:05 am
Location: France

Re: Create Projectile doesn't work in platform module?

Post by dale_coop » Tue Sep 25, 2018 8:40 am

Create your player's shooting animations, assign it to the "Action step 3" (don't forget to set an animation speed, and a "GoToFirst" for the "End of animation").
Create your projectile: the script uses the "Melee" object, set it as "player weapon", with a speed and acceleration. Also, set Edge And Solid object collision to "Destroy Me", a bounding box.
Then, use the ShootWeapon.asm script (assign it to the "Press" "A" button). Don't forget to comment the lines related to "preventShooting" (means comment lines 27, 28 and lines 35, 36), in the script.

if you need to adjust the position of the projectile...
For example, replace, vertically, you need to affect the object_y_hi, replacing:

Code: Select all

LDA Object_y_hi,x
STA temp1
with:

Code: Select all

LDA Object_y_hi,x
SEC
SBC #$08  ;; height pixels higher
STA temp1
Or with:

Code: Select all

LDA Object_y_hi,x
CLC
ADC #$08  ;; height pixels lower
STA temp1
-----
Sorry about my poor english
All I need: A Damn Fine Cup of Coffee
My games: PRESS START GAME / UNDERGROUND ADVENTURE
User avatar
ildalla83
Posts: 8
Joined: Thu Sep 20, 2018 3:23 pm
Location: Italy

Re: Create Projectile doesn't work in platform module?

Post by ildalla83 » Tue Sep 25, 2018 11:19 am

dale_coop wrote:
Tue Sep 25, 2018 8:40 am
Create your player's shooting animations, assign it to the "Action step 3" (don't forget to set an animation speed, and a "GoToFirst" for the "End of animation").
Create your projectile: the script uses the "Melee" object, set it as "player weapon", with a speed and acceleration. Also, set Edge And Solid object collision to "Destroy Me", a bounding box.
Then, use the ShootWeapon.asm script (assign it to the "Press" "A" button). Don't forget to comment the lines related to "preventShooting" (means comment lines 27, 28 and lines 35, 36), in the script.

if you need to adjust the position of the projectile...
For example, replace, vertically, you need to affect the object_y_hi, replacing:

Code: Select all

LDA Object_y_hi,x
STA temp1
with:

Code: Select all

LDA Object_y_hi,x
SEC
SBC #$08  ;; height pixels higher
STA temp1
Or with:

Code: Select all

LDA Object_y_hi,x
CLC
ADC #$08  ;; height pixels lower
STA temp1
Tnx for the tutorial, but:
  • If I delete lines related to "preventShooting", it cannot work... I used "LDA #$00" and "STA preventShooting" on top of the script.
  • This code tutorial is perfect for idle shooting, but I also want to shoot in movement (run and jump). How can I do that?
  • If I run the game in Test mode and I try to shoot without previus movement, it create a fix projectile in the top-left corner of my character... how can avoid this situation?
:shock: :shock: :shock:
User avatar
dale_coop
Posts: 1294
Joined: Fri Feb 16, 2018 7:05 am
Location: France

Re: Create Projectile doesn't work in platform module?

Post by dale_coop » Tue Sep 25, 2018 2:51 pm

You will not be able to have shooting animation and the jump/run animation.
(of course, you can have projectile while running or jumping... but not your specific player shooting animation)

To allow projectile while running/jumping...
Replace:

Code: Select all

BNE +
 
 ChangeObjectState #$03, #$08

  CreateObject temp,temp1,#$01, #$00
By:

Code: Select all

BNE +

 GetCurrentActionType player1_object
 CMP #$01
 BEQ continueShooting
 CMP #$02
 BEQ continueShooting 
 
 ChangeObjectState #$03, #$08

continueShooting:
  CreateObject temp,temp1,#$01, #$00

And for the shooting problem when no movement, at start...
Replace:

Code: Select all

	LDA Object_movement,x
    AND #%00000111
    STA temp3
By:

Code: Select all

	LDA Object_movement,x
    AND #%00000111
    ORA #%00000010	
    STA temp3
-----
Sorry about my poor english
All I need: A Damn Fine Cup of Coffee
My games: PRESS START GAME / UNDERGROUND ADVENTURE
User avatar
ildalla83
Posts: 8
Joined: Thu Sep 20, 2018 3:23 pm
Location: Italy

Re: Create Projectile doesn't work in platform module?

Post by ildalla83 » Wed Sep 26, 2018 3:10 pm

Good! Thank you
:shock: :shock: :shock:
User avatar
Nintend0Nerd
Posts: 44
Joined: Tue Sep 25, 2018 4:33 pm
Location: Illinois

Re: Create Projectile doesn't work in platform module?

Post by Nintend0Nerd » Thu Sep 27, 2018 2:40 am

I got it so that my character finally shoots a projectile. The only problem is that after he shoots he cannot shoot again. I can do it only once. Even if I move to a different screen. I'm not sure what's causing it.
User avatar
dale_coop
Posts: 1294
Joined: Fri Feb 16, 2018 7:05 am
Location: France

Re: Create Projectile doesn't work in platform module?

Post by dale_coop » Thu Sep 27, 2018 6:02 am

Because it’s using the preventShooting variable.
Either comment the lines related to "preventShooting" (means comment lines 27, 28 and lines 35, 36), in the original script.
Or add at the beginning the script:

Code: Select all

  LDA #$00
  STA preventShooting
-----
Sorry about my poor english
All I need: A Damn Fine Cup of Coffee
My games: PRESS START GAME / UNDERGROUND ADVENTURE
Post Reply