-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathunusedCode.js
More file actions
104 lines (75 loc) · 4.97 KB
/
unusedCode.js
File metadata and controls
104 lines (75 loc) · 4.97 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
// // push link back in a specific direction
// /*
// If link is moving towards the enemy and the enemy is moving towards link, push link
// back in the direction the enemy is facing
// enemy is going right, link is going left, push link back to the right
// If the enemy puts force upon link, push them in the direction the enemy is going.
// How do we determine who is applying force upon who?
// Well, we can determine this by seeing whose future position would overlap the others position.
// There is also the circumstance that link hits a stationary enemy or dangerous obstacle that does damage,
// like the flame, in this case he would be pushed back
// */
// const linkFacing = link.components["Character"].facing;
// const linkMovement = link.components["Movement"];
// const enemyFacing = enemy.components["Character"].facing;
// console.log(linkFacing, enemyFacing)
// if(linkFacing === "up" && enemyFacing === "down") {
// // push link down
// }
// else if (linkFacing === "down" && enemyFacing === "up") {
// // push link up
// }
// else if (linkFacing === "left" && enemyFacing === "right") {
// // push link right
// linkMovement.vX = 5;
// }
// else if (linkFacing === "right" && enemyFacing === "left") {
// // push link left
// }
// // add discoloration
// // console.log("damage to link")s
// // Multiple scenarios could happen here
// // First thing, if an enemy projectile or an enemy body hits the player, damage the player
// // if hitboxI is enemy/enemyAttacxk and hitboxJ is link
// // or if hitboxJ is enemy/enemyAttack and hitboxI is link
// if(
// (
// hitboxI.owner % 2 === 0
// &&
// hitboxJ.owner === 3
// ) ||
// (
// hitboxJ.owner % 2 === 0
// &&
// hitboxI.owner === 3
// )
// ) {
// // do damage to link
// const link = hitboxI.owner === 3 ? entityI : entityJ;
// const enemy = hitboxI.owner % 2 === 0 ? entityI : entityJ;
// link.components["Health"].remainingHealth = link.components["Health"].remainingHealth - 0.5;
// }
// // if hitboxI is enemy and hitboxJ is link attack
// // if hitboxI is link attack and hitboxJ is enemy
// else if(
// (
// hitboxI.owner % 2 === 0
// &&
// hitboxJ.owner === 1
// ) ||
// (
// hitboxI.owner === 1
// &&
// hitboxJ.owner % 2 ===0
// )
// ) {
// // do damage to enemy
// // const linkAttack = hitboxI.owner === 3 ? entityI : entityJ;
// // const enemy = hitboxI.owner % 2 === 0 ? entityI : entityJ;
// console.log("Enemy: " , enemy)
// // if(linkAttack) {
// // enemy.components["Health"].remainingHealth = enemy.components["Health"].remainingHealth - linkAttack.components["Hitbox"].damage;
// // console.log("damange to enemy :" , linkAttack, linkAttack.components["Hitbox"].damage)
// // console.log(enemy.components["Health"].remainingHealth);
// // }
// }