If you’re reading this, there probably aren’t very many posts yet. But don’t worry, you can be the first! Either create a new post or just reply to this one to say ‘hi’.
A logical extension of this, and possible game design and tuning decision, is to now have an option for whether Friendly Fire is disabled or enabled.
Especially in the case at least of the player’s own projectiles and attacks - if not the enemy’s ** - in order to increase the difficulty when doing rescue/escort missions or just having companions and followers.
** An argument for allowing enemy friendly fire is that it could potentially make it an easier difficulty level to play, but perhaps the player doesn’t get the benefit of the experience gains or loot if enemies take each other out.
Thought post a slight update video to show how i am geting along in the course.
No issues so far and finally they stop killing themselves! Not sure if my healer is still being a traitor and healing them though as i have her on an NPC layer.
How very cool, sorry the projectiles are so ugly, we’ll fix that soon.
On the topic of splitting methods into multiple smaller methods.
Is there a performance hit in doing this because of pushing current state on the stack and then popping it at the return, or is this handled by the compiler.
Hi there, this is more of a question of whether the smaller methods are creating “instruction cache misses” where the CPU predicts an instruction wrongly.
It’s really hard to know without performance measuring tools, and unless there’s a problem it’s not worth worrying about.
Often the compiler will “inline” functions to solve this issue.
Enjoy the course
Hi all, but mostly @ben and @Rick_Davidson I noticed during the video that there is no case for the projectile hitting the enemy so the projectiles just bounce off the enemies and it looks bad.
Rest assured we’ll be doing a lot more work on the projectiles later in the course
My solution was a bit simpler.
- In Enemy.FireProjectile() I added:
newProjectile.gameObject.layer = gameObject.layer;
In Projectile.OnColisionEnter(), I compare the projectile and collision object layers, as bolded below.
if (damageable != null && (collision.gameObject.layer != gameObject.layer)) damageable.TakeDamage(damageCaused);