mirror of
https://github.com/Relintai/broken_seals_2d.git
synced 2024-11-11 20:35:10 +01:00
Now a few mobs get spawned, also fixed targeting.
This commit is contained in:
parent
90a602a81f
commit
5a1460df0e
@ -302,7 +302,7 @@ func spawn(createinfo : EntityCreateInfo, networked : bool, position : Vector2,
|
||||
spawn_parent.add_child(entity_node)
|
||||
entity_node.owner = spawn_parent
|
||||
|
||||
entity_node.translation = position
|
||||
entity_node.position = position
|
||||
|
||||
entity_node.initialize(createinfo)
|
||||
|
||||
|
@ -199,9 +199,9 @@ func _unhandled_input(event: InputEvent) -> void:
|
||||
# if event.button_index == BUTTON_WHEEL_DOWN:
|
||||
# camera_pivot.camera_distance_set_delta(0.2)
|
||||
|
||||
if not event.pressed and event.button_index == BUTTON_LEFT and event.device != -1:
|
||||
if mouse_down_delta.length() < MOUSE_TARGET_MAX_OFFSET:
|
||||
target(event.position)
|
||||
# if not event.pressed and event.button_index == BUTTON_LEFT and event.device != -1:
|
||||
# if mouse_down_delta.length() < MOUSE_TARGET_MAX_OFFSET:
|
||||
# target(event.position)
|
||||
|
||||
if event.pressed and event.button_index == BUTTON_RIGHT and event.device != -1:
|
||||
target(event.position)
|
||||
@ -215,8 +215,8 @@ func _unhandled_input(event: InputEvent) -> void:
|
||||
|
||||
func target(position : Vector2):
|
||||
var space_state = get_world_2d().direct_space_state
|
||||
#var results = space_state.intersect_point(map.make_canvas_position_local(position), 32, [], 2)
|
||||
var results = space_state.intersect_point(position, 32, [], 2)
|
||||
var results = space_state.intersect_point(world.make_canvas_position_local(position), 32, [], 2)
|
||||
#var results = space_state.intersect_point(position, 32, [], 2)
|
||||
|
||||
if results:
|
||||
for result in results:
|
||||
@ -231,8 +231,8 @@ func target(position : Vector2):
|
||||
|
||||
func cmouseover(event):
|
||||
var space_state = get_world_2d().direct_space_state
|
||||
#var results = space_state.intersect_point(map.make_canvas_position_local(position), 32, [], 2)
|
||||
var results = space_state.intersect_point(position, 32, [], 2)
|
||||
var results = space_state.intersect_point(world.make_canvas_position_local(position), 32, [], 2)
|
||||
#var results = space_state.intersect_point(position, 32, [], 2)
|
||||
|
||||
if results:
|
||||
for result in results:
|
||||
|
@ -21,8 +21,15 @@ func load_character(file_name: String) -> void:
|
||||
# _player.set_physics_process(false)
|
||||
|
||||
Server.sset_seed(_player.sseed)
|
||||
|
||||
generate()
|
||||
|
||||
|
||||
func generate() -> void:
|
||||
for x in range(-5, 5):
|
||||
for y in range(-5, 5):
|
||||
Entities.spawn_mob(1, 50, Vector2(x * 200, y * 200))
|
||||
|
||||
func save() -> void:
|
||||
if _player == null or _player_file_name == "":
|
||||
return
|
||||
|
Loading…
Reference in New Issue
Block a user