The editor is saying "Expected ',' or ')' " on a line where there is no need for it.

:information_source: Attention Topic was automatically imported from the old Question2Answer platform.
:bust_in_silhouette: Asked By Noob_Maker
:warning: Old Version Published before Godot 3 was released.

Basically, I was editing the code and for some weird reason it was saying

Expected ‘,’ or ‘)’

but it was a normal function.This is the code to look at(the line that it’s targeting the error is line 72 where it starts: if is_ touching _wallL):

extends RigidBody2D
#The variables
var s = 200
var c_s = Vector2(0,0)
var raycast = null
var raycastL= null
var raycastR= null
var jumpforce = 220
var pushoff = 100
#controls
var Right = Input.is_action_pressed("right")
var Left = Input.is_action_pressed("left")
var Jump = Input.is_action_pressed("jump")
#dashing mechanics variables

#Collition thingy so that I don't have to go crazy when the sprite changes and because it will crouch so yeah

#ground check(never thought I'll be using this)

#how to use raycasts(if I ever forget...again):if raycast_1.is_colliding():
   #if raycast_1.get_collider().get_name() == "object":
     # do_something
   #elif raycast_1.get_collider().get_name() == "other_object":
    # do_something_else
#raycast_1 = get_node("left_ray")
#raycast_2 = get_node("right_ray")

func is_touching_wallR():
	if raycastR.is_colliding():
		return true
	else:
		return false

func is_touching_wallL():
	if raycastL.is_colliding():
		return true
	else:
		return false

func is_on_ground():
	if raycast.is_colliding():
		return true
	else:
		return false
	
func _ready():
	raycast = get_node("RayCast2D")
	raycastL = get_node("RayCast2Dleft")
	raycastR = get_node("RayCast2Dright")
	raycast.add_exception(self)
	raycastR.add_exception(self)
	set_fixed_process(true)
	set_gravity_scale(3)
	
#movement(walking)
func _fixed_process(delta):
	Right = Input.is_action_pressed ("right")
	Left = Input.is_action_pressed ("left")
	Jump = Input.is_action_pressed ("jump")
	if Right == true:
		set_linear_velocity(Vector2 (s, get_linear_velocity().y))
	elif Left == true:
		set_linear_velocity(Vector2(-s, get_linear_velocity().y))
	else:
		set_linear_velocity(Vector2 (0, get_linear_velocity().y))
	if is_on_ground():
		if Jump: 
			set_axis_velocity(Vector2(0,-jumpforce))
	if is_touching_wallR():
		if Jump:
			set_axis_velocity(Vector2(-pushoff,0)
	if is_touching_wallL():
		if Jump:
			set_axis_
	#dashing
	
	

I have no idea what’s going on.

code snippet? screenshot? any info?

rustyStriker | 2017-05-21 15:59

for beginner, just use set_pos() and get_pos() first, you will need a lot of brackets working with physics

Phil88n | 2017-06-19 14:29

:bust_in_silhouette: Reply From: eons

If says Expected ‘,’ or ‘)’, could be that you are missing a ‘,’ or ‘)’, like in

if is_touching_wallR():
    if Jump:
        set_axis_velocity(Vector2(-pushoff,0)  <----------- there

Is normal for some situations to point an error to the next line, because it could be a valid sentence sometimes.

There is a comma and there is a ‘)’ in there…OOOOH! Okay thanks, I’m not the best when it comes with small little details like that.

Noob_Maker | 2017-05-21 20:15

Some people likes to use spaces after and before some symbols, it may help to make code more clear.

set_axis_velocity( Vector2( -pushoff , 0 )  

Error here may be more visible thanks to the less compact code.

eons | 2017-05-21 23:54