You are browsing as a guest. Sign up (or log in) to start making projects!

Open comments for this post

2h 56m 30s logged

DEVLOG - 07 added vertical dash wall jumping and started with the tutorial level

today i wanted to design the first level so i looked up what good level builders there are and saw trenchbroom and after like an hour of trying to make it work on fedora i gave up and tried something called cyclops but it doesnt support my current godot version so i spent MORE TIME diving into its code because there was only 1 small error(or so i thought) which i managed to fix but then every like 3 minutes of using it it just crashed so i guess im sticking with normal godot
AND it took me like 20 versions and about 5 commits that i thought i fixed it to get to a working version of the 4 line code that lets me dash vertically but setting it up based on camera lets you dash up and gain insane momentum instantly so i tried a system of my own which calculated you vertical velocity using your horizontal one and tried a bunch of formulas and ended up with this fine version

so the wall jumping was very easy to do because i just reflect the current movement and add a boost the hard part was that every time before hitting the wall i would already switch in my keyboard to the other other direction so to deal with that i “predicted the future” like i did with the slopes so that the movement feels smoother but to deal with the problem of the keyboard switching i also checked for the opposite directions(which is bassicly copy paste with minuses)so here is the code for that:

	if is_on_floor():
		canWallJump = false
		return
	var veloc = Vector3(velocity.x,velocity.y,velocity.z)
	#var future = self.global_position + veloc
	for i in get_slide_collision_count():
		var collision = get_slide_collision(i)
		if collision.get_normal().y < .3:
			wallNormal = collision.get_normal()
			canWallJump = true
			return
			
	
	if veloc.length() > 0.5:
		var spaceState = get_world_3d().direct_space_state
		var ray = PhysicsRayQueryParameters3D.create(global_position,global_position + veloc.normalized() * 1.2)
		ray.exclude = [self.get_rid()]
		var hit = spaceState.intersect_ray(ray)
		if hit and hit.normal.y < .3:
			wallNormal = hit.normal
			canWallJump = true
			return
	
	var altVeloc = Vector3(-velocity.x,velocity.y,velocity.z)
	if altVeloc.length() > 0.5:
		var spaceState = get_world_3d().direct_space_state
		var ray = PhysicsRayQueryParameters3D.create(global_position,global_position + altVeloc.normalized() * 1.2)
		ray.exclude = [self.get_rid()]
		var hit = spaceState.intersect_ray(ray)
		if hit and hit.normal.y < .3:
			wallNormal = hit.normal
			canWallJump = true
			return
	altVeloc = Vector3(velocity.x,velocity.y,-velocity.z)
	if altVeloc.length() > 0.5:
		var spaceState = get_world_3d().direct_space_state
		var ray = PhysicsRayQueryParameters3D.create(global_position,global_position + altVeloc.normalized() * 1.2)
		ray.exclude = [self.get_rid()]
		var hit = spaceState.intersect_ray(ray)
		if hit and hit.normal.y < .3:
			wallNormal = hit.normal
			canWallJump = true
			return
	
	canWallJump = false```

anyway here is a clip of the tutorial level now(compressed cause it was somehow 155mb):



**NOTE**: it will be updated on itch.io after i finish making this tutorial level im just a little tired today and couldnt work on the project yesterday so i uploaded this devlog early
1
10

Comments 0

No comments yet. Be the first!