User:Cabra/Sandbox: Difference between revisions

From TestWiki
Content added Content deleted
(Less, because I prefer it in other place.)
mNo edit summary
Line 34: Line 34:
const MAX_SPEED = 250
const MAX_SPEED = 250


func _process(_delta):
func _process(delta):
var speed = Vector2.ZERO
var speed = Vector2.ZERO
if Input.is_action_pressed("move_right"):
if Input.is_action_pressed("move_right"):
Line 43: Line 43:
if speed.length() > 0:
if speed.length() > 0:
speed = speed.normalized() * MAX_SPEED
speed = speed.normalized() * MAX_SPEED
position += speed * _delta
position += speed * delta
</syntaxhighlight>
</syntaxhighlight>



Revision as of 02:54, 14 July 2022

This 1 2 3 4 6 7.
EEEEEh

This is my sandbox.[1] And it will be actively updated.[1]

First header

First one.

Code example

#include <iostream>

int main()
{
	int x{0};
	while (x != 8)
	{
		std::cout << "Ehh\n";
		x += 1;
		std::cout << "x = " << x << '\n';
	}
	return 0;
}

Why is this thing even here? lol
Not likely to use it outside this sandbox, though. Don't see how.

extends Area2D

const MAX_SPEED = 250

func _process(delta):
	var speed = Vector2.ZERO
	if Input.is_action_pressed("move_right"):
		speed.x += 1
	else:
		speed.x -= 1
	## I don't know, test
	if speed.length() > 0:
		speed = speed.normalized() * MAX_SPEED
	position += speed * delta

References

  1. 1.0 1.1 Me