Be the first to post for 'InvokeRepeating() vs StartCoroutine()'!

rpg_s02_invokerepeating_vs_startcoroutine

#21

Hey I love the globes!


#22

Another way to hide a public variable from the inspector is

[HideInInspector]    public float damageCaused = 20;

#23

Interesting exercise to make this video. Thanks to is irresistiblejelly for the pointer to OBS Studio.


#24

Thanks, OBS studio seems pretty powerful.


#25

I don’t know if anyone is interested but here is an alternative to InvokeRepeating. It seems 10x clearer to me.
You are not dealing with bools or string references.

if(distanceToPlayer < attackRadius && Time.time >= nextTimeToFire)
{
	nextTimeToFire = Time.time + 1f / attacksPerSecond;
	SpawnProjectile();
}

Just putting it out here for anyone interested.
BTW: I think that game designers would like to see attacks per second rather than seconds between shots.


#26

It’s been great fun working through this course so far.

here’s my hero being chased around the market square. If he goes out of range of the attacker they will return to their starting location. This is done by instantiating an empty game object at their location before they give chase to the player (similar to how the player’s movement works).


#27

Hola !

Rbots now encounter new enemies : Drones !

Drones are firing sphere (not designed yet) and as saw before crawler are casting their lightning.
Each enemy type have his own attack/chase range and they chase player at the time they ‘saw’ him and that he doesn’t left the chasing range.
Tweaks has to be done on ranges but it works :smiley:


#29

Looking good! :slight_smile:


#30

Hmm, never captured a video before… but here goes…:

Hope you like my shield-wall at the end.


#31

@Dieedi

Made me smile just watching that. Love the direction you’re going in with this.


#32

Finally find some time to return to the course. I made logic a bit different, So my bullet flying, and damage code is on the bullet only. Shoot code takes care of instantiation, rotation and all other effects (sound, muzzle in the future). Enemy only calls shoot if player is in Sight. Enemy also has sight cone, so you can sneak from the back, and has hear cone, so if you run it will turn around (TODO), will shoot unless you come to the smaller circle, then it will chase.


#33

Video. Everything is prone to be changed hahahahahaha, especially since I haven’t made a thing for monsters. And I’m still not decided if I’ll keep those assets. They’re nice, but I didn’t made them, and anything I make looks very different I think. I made a log bridge on this level for example.

But yeah, I’ll probably leave this as a prototype, then rework it as something else. Just to continue with the course.


#34

This is a very late reply but that is a really neat scenario, more in line with a Diablo’esque style which i’d prefer rather than the comic approach… thumbs up man.
It looks like you either have been doing some programming for a while or have done some more extended programming in between the lectures…

If i would comment on anything is the animation on the skeleton which looks a bit odd when the stance changes upon shooting. I’d go for a more “rickety” type of walk, like i would visualize a re-animated corpse without muscles and tishue walking… Even with a little sprinkle of “magic” where the skeleton gains superpowers i think a more fragile type of walk or stance would increase the “eeriness” of such opponent.
(if that’s the goal )
By the way: I would play your game any day.

Cheers…


#35

Hey Orochii, I laughed so hard when i saw the dust trail after the knight when running out of bounds into the abyss…
Actually i had a vision to do this type of particle effect on my player but a much more, over the top exagerrated smoke cloud around the players feet and also raise the animation speed making him look like sonic the hedgehog, also lowering the movespeed, adding some groans and moans on the running would make it even more ridiculous…

Anyway, your approach looks really nice

Cheers


#36

I heard you liked fireballs.

Friendly fire? I liked the fact that they can hit each other and take damage.

I spent a bit longer on this and messed with the animation system. Turns out there is an event trigger that you can get to. It will call back to a method (started to type function) in the enemy (wizard actually) script. That method is what actually sends the fireball on it’s way. All I do in the co-routine is fire off the animation and Unity does the rest for me. I still don’t understand the occasional skating, the usual fixes I’ve seen don’t seem to be working in this case.