Skip to content

Commit e88c4d4

Browse files
committed
update
1 parent dfc20c4 commit e88c4d4

File tree

4 files changed

+12
-18
lines changed

4 files changed

+12
-18
lines changed
5.81 KB
Binary file not shown.

src/javagameengine/backend/Scene.java

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -56,7 +56,6 @@ public void start(){
5656

5757
setActive(true);
5858
setBackground(new Color(44, 157, 228));
59-
6059
UpdateThread.camera.setPosition(new Vector2(0,0));
6160

6261
}

src/javagameengine/components/GameObject.java

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,8 @@
1818

1919
public class GameObject extends Component{
2020

21+
public GameObject(){}
22+
public GameObject(Vector2 pos){this.position = pos;}
2123
private LinkedList<String> ignoreTags = new LinkedList<>();
2224

2325
/**

src/javagameengine/mapeditor/DrawingBoard.kt

Lines changed: 10 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ class Rect(pos : Vector2 = Vector2.zero) : Component() {
1919
}
2020

2121
override fun draw(g: Graphics?) {
22-
g!!.drawRect(position.x.toInt(), position.y.toInt(), scale.x.toInt(), scale.y.toInt());
22+
g!!.drawRect(spritePosition.x.toInt(), spritePosition.y.toInt(), scale.x.toInt(), scale.y.toInt());
2323
}
2424
}
2525

@@ -28,28 +28,21 @@ class DrawingBoard : Scene(){
2828
var size : Vector2 = Vector2(50f,50f);
2929

3030
init {
31-
for(x in 100 downTo 0 step 1){
32-
for(y in 10 downTo 0 step 1){
33-
components.add(Rect(Vector2(x.toFloat(), y.toFloat()).multiply(size)))
34-
}
35-
}
31+
3632
UpdateThread.camera.addChild(CameraMovement(4f))
3733
}
3834

35+
override fun paintComponents(g: Graphics?) {
36+
super.paintComponents(g)
37+
for(x in 10 downTo 0){
38+
for(y in 10 downTo 0){
39+
g!!.drawRect(x*size.x.toInt(),y*size.y.toInt(),size.x.toInt(),size.y.toInt())
40+
}
41+
}
42+
}
3943
override fun update() {
4044
super.update()
41-
if(Input.isMouseDown(Keys.LEFTCLICK)){
42-
for(c in components){
43-
if(c.isMouseInside){
44-
Debug.log(c.position)
45-
var g = GameObject();
46-
g.position = c.position
47-
g.scale = c.scale
48-
c.instantiate(g)
49-
}
50-
}
5145

52-
}
5346
}
5447

5548
}

0 commit comments

Comments
 (0)