On the way - to Awesome Platfomer (Mario) part III.
It took my half an hour to find the error mentioned in last post! But it works now. It seems I did not pay enough attention to the tutor because I swapped few variables. For debug I used observing of variables at the object by using annotation [SerializeField].
What is worth to point out is that each tutor has different approach to the cerating things. For example in Ultimate guide there was an "Enemy" script containing all logic of the enemy from moving to dying. In course which I have been working on now there is "PlayerMovement" script, "PlayerShooting" script. The first approach is more suitable for me because it is done in a way I understand the OOP. But I get it that probably the second tutor is more like "one behaviour, one script" type of a guy. Also this guy is doing everything public even if it does not need to communicate with other classes therefore at Ultimage guide it was mostly private with serialization field for easy debug.
What is worth to point out is that each tutor has different approach to the cerating things. For example in Ultimate guide there was an "Enemy" script containing all logic of the enemy from moving to dying. In course which I have been working on now there is "PlayerMovement" script, "PlayerShooting" script. The first approach is more suitable for me because it is done in a way I understand the OOP. But I get it that probably the second tutor is more like "one behaviour, one script" type of a guy. Also this guy is doing everything public even if it does not need to communicate with other classes therefore at Ultimage guide it was mostly private with serialization field for easy debug.
Some usefull hints
- Pay attention!
- Step 34: do not store to the temp collision as position of a collision in a world space coordinates (_collision.position), but in a local space coordinates (_collision.localspace). It is just a pure luck that it works for him because once you use the temp collision to switch a direction the collision point will be far far away from an actual enemy and thats wrong!
- If you have an object A with collider and object B with collider with "isTrigger" you can use OnTrigger on object A also. I didnt know that, did you?!
Time spent on learning [7:47:14] And those 14 second are especially important!

Comments
Post a Comment