Enemy Projectiles

Post Reply
User avatar
ZeGGamer1
Posts: 103
Joined: Thu Nov 29, 2018 11:26 pm
Contact:

Enemy Projectiles

Post by ZeGGamer1 » Sat Feb 09, 2019 4:37 pm

Hey, Does anyone know how to do Enemy Projectiles?
Let's all have a good time! (And cry because Assembly is hard)
Game: Blickel http://nesmakers.com/viewtopic.php?f=52&t=2561
User avatar
dale_coop
Posts: 5625
Joined: Fri Feb 16, 2018 7:05 am
Location: France

Re: Enemy Projectiles

Post by dale_coop » Sat Feb 09, 2019 11:08 pm

Yeah, first, you will need to fix the ignore gravity (to make projectiles move):
http://nesmakers.com/viewtopic.php?f=35&t=1939

About the monster's projectiles... there are two kind of shooting: "shoot straight" and "shoot at player" that are 2 different action scripts
One uses the a “OBJ_MONSTER_PROJECTILE” user constant to set which object to use as projectile.
And the other one uses by default the “Effect 2” game object.
Both of your projectiles objects have to bébés set as “monster weapon”, with a speed and acceleration values, also “destroy me” on edge/solid reaction.
For the “shoot straight”, just check the “ignore collision” for the action step 0.
For the “shoot toward player”, check the “ignore gravity” AND “use aimed physics” for action step 0. (Because the behavior is different then the normal physics).
And don’t forget to define the bounding box.

Now your monster can use the actions in order to shoot. Make sure it moves before shorting (Because I think monsters are facing down at start).

PS: of course you could do some modifications to the shooting scripts
(I would suggest to use for both the same user constant, to be able to use the same object, justaube a different action step “0” for the straight and the “1” for the towards player).

The modification of the createobject part would look like that (the shoot straight):

Code: Select all

CreateObject temp1, temp2, #OBJ_MONSTER_PROJECTILE, #$00, temp
And for shoot towards player:

Code: Select all

CreateObject temp1, temp2, #OBJ_MONSTER_PROJECTILE, #$01, temp
-----
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)
My son's game: KUBO 3
User avatar
ZeGGamer1
Posts: 103
Joined: Thu Nov 29, 2018 11:26 pm
Contact:

Re: Enemy Projectiles

Post by ZeGGamer1 » Sun Feb 10, 2019 1:57 am

1: how do I set a user constant to an object, and 2: Isn't effect 2 used for player victory?
Let's all have a good time! (And cry because Assembly is hard)
Game: Blickel http://nesmakers.com/viewtopic.php?f=52&t=2561
User avatar
dale_coop
Posts: 5625
Joined: Fri Feb 16, 2018 7:05 am
Location: France

Re: Enemy Projectiles

Post by dale_coop » Sun Feb 10, 2019 7:27 am

1: In "Project Settings > User Constants" it lists YOUR game constants. Here, you will find a constant named OBJ_MONSTER_PROJECTILES. That is used by the "shoot towards player" script. You have to set the index value of the object you want to use (just count the game object, starting from 0: for example if you want to use the "Source projectile" game object, set "3").

2: Yes, too... but by default, the "shoot straight" script uses this object, the "Effect 2":

Code: Select all

	CreateObject temp1, temp2, #$0A, #$00, temp
(I didn't write this code)
So I'd suggest to modify this script to :

Code: Select all

	CreateObject temp1, temp2, #OBJ_MONSTER_PROJECTILES, #$01, temp
So now you can use the same unique object for your monster projecile, and just different Action Steps :
Action Step 0:
Image
Action Step 1:
Image

Voilà :)
-----
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)
My son's game: KUBO 3
User avatar
ZeGGamer1
Posts: 103
Joined: Thu Nov 29, 2018 11:26 pm
Contact:

Re: Enemy Projectiles

Post by ZeGGamer1 » Sun Feb 10, 2019 3:50 pm

Cool, Thanks!
Let's all have a good time! (And cry because Assembly is hard)
Game: Blickel http://nesmakers.com/viewtopic.php?f=52&t=2561
User avatar
BentPawGames
Posts: 216
Joined: Wed Jan 16, 2019 10:29 pm

Re: Enemy Projectiles

Post by BentPawGames » Sat Feb 23, 2019 7:41 pm

So I was trying to set up my monster projectile and it just created my player's melee object, but it was technically working. I went into user constants and started playing around. After that, the game and I got this error:

Routines\BASIC_021019\ModuleScripts\AiScripts\ShootTowardsPlayer.asm(18):CreateObject(26): Unknown label.
demo.txt written.

I went to change the user constant back to the default setting ("1" I believe), but it is still broke and I get that error unless i just outright remove the "shoot toward player" script.
User avatar
dale_coop
Posts: 5625
Joined: Fri Feb 16, 2018 7:05 am
Location: France

Re: Enemy Projectiles

Post by dale_coop » Sat Feb 23, 2019 10:05 pm

In the ShootTowardsPlayer script, line 18... you will see a CreateObject line ... one of the parameter is the user constant... OBJ_MONSTER_PROJECTILE (or maybe OBJ_MONSTER_PROJECTILES with an "S")
Then, in the Project Settings > Script Settings, check this user constant exists... with the same exact name. Else "Add" it with the same name as written in your script (Copy/Paste it...) and give it the id/number of the object you want to use for monster projectiles ("3" maybe ?).

Image
-----
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)
My son's game: KUBO 3
User avatar
BentPawGames
Posts: 216
Joined: Wed Jan 16, 2019 10:29 pm

Re: Enemy Projectiles

Post by BentPawGames » Sun Feb 24, 2019 5:23 am

Got it, thanks!

So for some reason under user constants, OBJ_MONSTER_PROJECTILE did exist, but it was listed as ";;;OBJ_MONSTER_PROJECTILE". No idea why there were 3 semicolons in front of it. It wasn't like that where you could type in the name yourself. So anyway, I deleted it, and then created a new one called OBJ_MONSTER_PROJECTILE, which got ride of the three semicolons, and fixed the problem :)
User avatar
dale_coop
Posts: 5625
Joined: Fri Feb 16, 2018 7:05 am
Location: France

Re: Enemy Projectiles

Post by dale_coop » Sun Feb 24, 2019 2:03 pm

BentPawGames wrote:
Sun Feb 24, 2019 5:23 am
No idea why there were 3 semicolons in front of it.
It means the constant is disabled. Just click on the "enabled" button, it will remove the semicolons.
-----
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)
My son's game: KUBO 3
User avatar
BentPawGames
Posts: 216
Joined: Wed Jan 16, 2019 10:29 pm

Re: Enemy Projectiles

Post by BentPawGames » Sun Feb 24, 2019 2:42 pm

ah good to know, thank you :)
Post Reply