Move_and_slide() delta error when extending from another script

:information_source: Attention Topic was automatically imported from the old Question2Answer platform.
:bust_in_silhouette: Asked By boyilearn

Hey!

First of all, thank you dearly for opening up this question.

I’m trying to recreate pong and make it two player. It’s for this reason that I decided to create one script - playerScript.gd - that handles the physics for both player1.gd and player2.gd, and then having different movement mappings between player 1 and 2.

I think the easiest way to show my problem is by adding the code.


**playerScript.gd**

```
extends KinematicBody2D
class_name player

export var speed = 300

#func _process(delta):
#	pass
```

This is the script that I will eventually use to handle the collision detection for both players.

player1.gd

extends player

# Declare member variables here. Examples:
# var a: int = 2
# var b: String = "text"

func _process(delta):
	var mov = Vector2()
	if Input.is_action_pressed("p1_up"):
		mov.y -= 1
	if Input.is_action_pressed("p1_down"):
		mov.y += 1

	mov = mov.normalized() * speed
	
	move_and_slide(mov)

move_and_slide(mov) is highlighted RED with this error:

Line 7 (UNUSED_ARGUMENT):The argument 'delta' is never used in the function '_process'.

Do I need to multiply something by the delta? I found that when I don't call the *classname player*, replace it with KinematicBody2D and include the *speed* variable in the *player1.gd* script, everything works fine and I'm able to move the player up and down.

The issue is this doesn't work when I try to call an external script.

What am I missing?

[wrap=comment]
The error `Line 7 (UNUSED_ARGUMENT):The argument 'delta' is never used in the function '_process'.` isn't really an error; it's a warning. You can use the `_process()` function without using the `delta` parameter. The `move_and_slide()` function factors in `delta`, so you don't need to multiply it by anything.

I don't know what's the problem with your script, though. There does seem to be a problem with your inheritance of the "player" script. But I don't exactly know what.
[wrap=footnote]Ertain | 2019-10-04 18:41[/wrap]
[/wrap]
:bust_in_silhouette: Reply From: Mikko

You should be able to inherit your playerScript class like this:

extends “playerScript.gd”