mirror of
https://github.com/Relintai/pandemonium_engine_minimal.git
synced 2024-11-10 20:12:10 +01:00
Implemented 2 test scripts.
This commit is contained in:
parent
88e8d53c52
commit
cba738c98c
51
test_2d_phys.gd
Normal file
51
test_2d_phys.gd
Normal file
@ -0,0 +1,51 @@
|
|||||||
|
extends SceneTree
|
||||||
|
|
||||||
|
func _initialize():
|
||||||
|
print("_initialize")
|
||||||
|
|
||||||
|
debug_collisions_hint = true
|
||||||
|
|
||||||
|
# Ground
|
||||||
|
var static_body = StaticBody2D.new()
|
||||||
|
root.add_child(static_body)
|
||||||
|
static_body.transform.origin = Vector2(500, 621)
|
||||||
|
|
||||||
|
var cs = CollisionShape2D.new()
|
||||||
|
static_body.add_child(cs)
|
||||||
|
cs.shape = RectangleShape2D.new()
|
||||||
|
cs.shape.extents = Vector2(1000, 40)
|
||||||
|
|
||||||
|
# "player"
|
||||||
|
var rigid_body = RigidBody2D.new()
|
||||||
|
root.add_child(rigid_body)
|
||||||
|
rigid_body.transform.origin = Vector2(500, 0)
|
||||||
|
rigid_body.angular_velocity = 0.1
|
||||||
|
|
||||||
|
cs = CollisionShape2D.new()
|
||||||
|
rigid_body.add_child(cs)
|
||||||
|
cs.shape = CapsuleShape2D.new()
|
||||||
|
cs.shape.radius = 145
|
||||||
|
cs.shape.height = 108
|
||||||
|
|
||||||
|
var s = Sprite.new()
|
||||||
|
rigid_body.add_child(s)
|
||||||
|
|
||||||
|
var img = Image.new()
|
||||||
|
img.load("icon.png")
|
||||||
|
print(img)
|
||||||
|
print(img.get_size())
|
||||||
|
|
||||||
|
var tex = ImageTexture.new()
|
||||||
|
tex.create_from_image(img)
|
||||||
|
s.texture = tex
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
19
test_ui.gd
Normal file
19
test_ui.gd
Normal file
@ -0,0 +1,19 @@
|
|||||||
|
extends SceneTree
|
||||||
|
|
||||||
|
func _initialize():
|
||||||
|
print("_initialize")
|
||||||
|
|
||||||
|
var pc = PanelContainer.new()
|
||||||
|
root.add_child(pc)
|
||||||
|
pc.set_anchors_and_margins_preset(Control.PRESET_WIDE)
|
||||||
|
|
||||||
|
var vb = VBoxContainer.new()
|
||||||
|
pc.add_child(vb)
|
||||||
|
|
||||||
|
var b = Button.new()
|
||||||
|
vb.add_child(b)
|
||||||
|
b.text = "test"
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue
Block a user