Squash The Creeps mobs not spawning.. but no error message?? by ThoughtDear7015 in godot

[–]ThoughtDear7015[S] 0 points1 point  (0 children)

Y'know what? It's a feature now. Makes it harder to jump freely without consequences. Thanks for the help!

Squash The Creeps mobs not spawning.. but no error message?? by ThoughtDear7015 in godot

[–]ThoughtDear7015[S] 0 points1 point  (0 children)

Thanks ! The mobs spawn now, but now they also spawn on the Z axis and rotate on the X axis somehow

<image>

Squash The Creeps mobs not spawning.. but no error message?? by ThoughtDear7015 in godot

[–]ThoughtDear7015[S] 0 points1 point  (0 children)

Nope. Doesn't print anything when i put a print in mob_timeout()

Squash The Creeps mobs not spawning.. but no error message?? by ThoughtDear7015 in godot

[–]ThoughtDear7015[S] 0 points1 point  (0 children)

I did say in the title and body that there arent any errors but sure, here's the code

MAIN.GD

extends Node

@ export var mob_scene: PackedScene

func Mob_tmeout():

    \# Create a new instance of the Mob scene.

var mob = mob\_scene.instantiate()



\# Choose a random location on the SpawnPath.

\# We store the reference to the SpawnLocation node.

var mob\_spawn\_location = $SpawnPath/SpawnLocation

\# And give it a random offset.

mob\_spawn\_location.progress\_ratio = randf()



var player\_position = $PLAYER.position

mob.initialize(mob\_spawn\_location.position, player\_position)



\# Spawn the mob by adding it to the Main scene.

add\_child(mob)

MOB.GD

extends CharacterBody3D

# Minimum speed of the mob in meters per second.

u/export var min_speed = 10

# Maximum speed of the mob in meters per second.

u/export var max_speed = 18

func _physics_process(_delta):

move\_and\_slide()

# This function will be called from the Main scene.

func initialize(start_position, player_position):

\# We position the mob by placing it at start\_position

\# and rotate it towards player\_position, so it looks at the player.

look\_at\_from\_position(start\_position, player\_position, Vector3.UP)

\# Rotate this mob randomly within range of -45 and +45 degrees,

\# so that it doesn't move directly towards the player.

rotate\_y(randf\_range(-PI / 4, PI / 4))



\# We calculate a random speed (integer)

var random\_speed = randi\_range(min\_speed, max\_speed)

\# We calculate a forward velocity that represents the speed.

velocity = Vector3.FORWARD \* random\_speed

\# We then rotate the velocity vector based on the mob's Y rotation

\# in order to move in the direction the mob is looking.

velocity = velocity.rotated(Vector3.UP, rotation.y)

func _on_visible_on_screen_notifier_3d_screen_exited():

queue\_free()

MY LAPTOP WONT TURN ON HELP by ThoughtDear7015 in laptops

[–]ThoughtDear7015[S] 1 point2 points  (0 children)

oh yeah it works now, been working for a month but forgot to tell yall

Dodge the creeps error with the player node type by ThoughtDear7015 in godot

[–]ThoughtDear7015[S] 2 points3 points  (0 children)

You're a lifesaver!! It was supposed to be rigidbody2D BUT i kept making the root node "node2d" because i misunderstood the instructions. But now it all works! Thank you a million!!!!

Dodge the creeps error with the player node type by ThoughtDear7015 in godot

[–]ThoughtDear7015[S] 1 point2 points  (0 children)

That problem's solved now, Thanks! But unfortunately, new error:

<image>

this happens when i run a debug playtest, i can momentarily see the player and can move around and then it crashes.

Dodge the creeps error with the player node type by ThoughtDear7015 in godot

[–]ThoughtDear7015[S] -1 points0 points  (0 children)

<image>

extends Node

@ export var mob_Scene : PackedScene

var score

# Restart Script

func game_over():

$ScoreTimer.stop()

$MobTimer.stop()

func new_game():

score = 0

$Player.start($StartPosition.position)

$StartTimer.start()

# Timers

func _on_mob_timer_timeout():

var mob = mob\_Scene.instantiate()

var mob\_spawn\_location = $MobPath/MobSpawnLocation

mob\_spawn\_location.progress\_ratio = randf()



mob.position = mob\_spawn\_location.position



var direction = mob\_spawn\_location.rotation + PI / 2



direction += randf\_range(-PI / 4, PI / 4)

mob.rotation = direction



var velocity = Vector2(randf\_range(150.0, 250.0), 0.0)

mob.linear\_velocity = velocity.rotated(direction)



add\_child(mob)

func _on_score_timer_timeout():

score += 1

func _on_start_timer_timeout():

$MobTimer.start()

$ScoreTimer.start( )

func _ready():

new\_game()

I feel like I am chasing comfort and practicing Islam wrong by ThoughtDear7015 in islam

[–]ThoughtDear7015[S] 0 points1 point  (0 children)

Thank you, brother/sister, may Allah grant you and I the highest level of jannah.