![]() |
Attention | Topic was automatically imported from the old Question2Answer platform. |
![]() |
Asked By | CarelPersonne |
extends Node2D
const PLAYERSPEED = 100
const INITBALLSPEED = 100
var screenSize
var padsize
var ballDirection = Vector2(1.0, 0.0)
var ballspeed = INITBALLSPEED
func _ready():
screenSize = get_viewport_rect().size
padsize = get_node("rightplayer").get_texture().get_size()
set_process(true)
pass
func _process(delta):
if(get_node("rightplayer").position.y > 18 and Input.is_action_pressed("ui_up")):
get_node("rightplayer").position.y += -PLAYERSPEED * delta
if(get_node("rightplayer").position.y < 382 and Input.is_action_pressed("ui_down")):
get_node("rightplayer").position.y += PLAYERSPEED * delta
if(get_node("leftplayer").position.y > 18 and Input.is_action_pressed("left_up")):
get_node("leftplayer").position.y += -PLAYERSPEED * delta
if(get_node("leftplayer").position.y < 382 and Input.is_action_pressed("left_down")):
get_node("leftplayer").position.y += PLAYERSPEED * delta
get_node("Ball") += ballDirection * ballspeed * delta
Hi Friends I am using Godot 3. There’s a mistake here.
get_node("Ball") += ballDirection * ballspeed * delta
help me