forked from Java-Game-Maker/JavaGameEngine
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathChildCollide.java
More file actions
94 lines (65 loc) · 2.31 KB
/
Copy pathChildCollide.java
File metadata and controls
94 lines (65 loc) · 2.31 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
package Testing;
import javagameengine.backend.Scene;
import javagameengine.backend.input.Input;
import javagameengine.backend.input.Keys;
import javagameengine.components.Component;
import javagameengine.components.GameObject;
import javagameengine.components.colliders.SquareCollider;
import javagameengine.components.physics.PhysicsBody;
import javagameengine.msc.Debug;
import javagameengine.msc.Vector2;
import java.awt.*;
import java.util.ArrayList;
/*
GameObject parent = new GameObject();
parent.setTag("parent1");
GameObject child = new GameObject();
child.setTag("child1");
child.addChild(new SquareCollider(true));
child.addChild(new PhysicsBody(false));
parent.addChild(new PhysicsBody());
parent.addChild(child);
GameObject parent2 = new GameObject();
parent.setTag("parent2");
parent2.setPosition(Main.origin.add(new Vector2(0,300)));
GameObject child2 = new GameObject();
child2.setTag("child2");
child2.addChild(new SquareCollider(true));
child2.addChild(new PhysicsBody(false));
parent2.addChild(child2);
components.add(parent);
components.add(parent2);
*/
public class ChildCollide extends Scene {
public ChildCollide(){
// Debug.showWhere = true;
GameObject parent = new GameObject();
parent.setTag("parent1");
GameObject child = new GameObject();
child.setTag("child1");
child.addChild(new SquareCollider(true));
// child.addChild(new PhysicsBody(false));
parent.addChild(new PhysicsBody());
parent.addChild(child);
GameObject parent2 = new GameObject();
parent.setTag("parent2");
parent2.setPosition(Main.origin.add(new Vector2(0,300)));
GameObject child2 = new GameObject();
child2.setTag("child2");
child2.addChild(new SquareCollider(true));
//child2.addChild(new PhysicsBody(false));
parent2.addChild(child2);
components.add(parent);
components.add(parent2);
}
@Override
public void update() {
super.update();
if(Input.isKeyPressed(Keys.A)){
Debug.log("A");
}
if(Input.isKeyPressed(Keys.D)){
Debug.log("D");
}
}
}