PokeVideoPlayer v23.9-app.js-020924_
0143ab93_videojs8_1563605 licensed under gpl3-or-later
Views : 217
Genre: Entertainment
Uploaded At Mar 17, 2024 ^^
warning: returnyoutubedislikes may not be accurate, this is just an estiment ehe :3
Rating : 5 (0/17 LTDR)
100.00% of the users lieked the video!!
0.00% of the users dislieked the video!!
User score: 100.00- Masterpiece Video
RYD date created : 2024-03-18T10:44:47.608136Z
See in json
Top Comments of this video!! :3
The shield should not be a child of the player.
In software, parent/child systems are an object-oriented approach to interfacing clones with various levels of similarity and functionality. A child object inherits all the properties and functions of the parent, and then adds its own functions and properties.
In non-code terms, lets use "feline" as the parent interface object. Let's say every feline has fur, 4 legs, and a tail. Now when we make a "housecat" object as a child of "feline," the cat will automatically have fur, 4 legs, and a tail. Then we can add other properties. So "housecat" has the properties small size, and meows as well as the inherited traits. We can also make "lion" a child of "feline" so it also inherits 4 legs, fur, and a tail, then give it the properties large and roars.
Back into code terms, if you make the shield a child of the player, you are getting a shortcut with a few functions like movement, but it comes with potential unintended consequences. Any property you ever give to the player object will also be given to the shield. So if, for instance, you add the ability to attack, or a health value to your ship, then while you have a shield it will do all those actions and properties twice.
The main use case for child objects is to make different states of the same thing, or to create an interface (which I will not get into). For instance, you could have an enemy ship. Make the enemy ship have generic properties, like hp, attack, basic behavior, etc. Then instead of adding that ship into your game, make a child version of the ship for various types/levels. So you make a level 1 gunship as a child of "enemy ship," where you fill in the properties that it only gets 1hp and only shoots bullets. Then you make another child that is a level 2 rocket ship where you give it 2hp and give it homing rockets as the attack type. Then you add the child objects into your game while leaving the master as a template borrowed by all your enemy ships.
For the shield directly, I would recommend 1 of 2 approaches:
1 - make it a separate and distinct object that floats around and moves with the ship
2 - make it into a property of the ship and update the sprite instead of using a separate object.
2 |
@agentdarkboote
8 months ago
Doesn't matter how you do it! This is how you get experience, and how you have fun doing it!
1 |