Page 1 of 1


Posted: Sat Dec 15, 2018 4:59 am
by RayureBob
Hi. Sorry for the weak title.

I'm trying to get a grasp on Pixilang's basics, and encountered a problem I cannot seem to figure out.

Here's the code I used, and here's the result

Code: Select all

set_pixel_size( WINDOW_XSIZE / 480 )
resize( get_screen(), WINDOW_XSIZE, WINDOW_YSIZE )

$y = 0
speed = 10

while 1 {
	//line(xpoint1, ypoint1, xpoint2, ypoint2
	line(0, 0, $x, $y, RED)
//sup droite vers inf droite
	if $x == WINDOW_XSIZE {
		if $y != WINDOW_YSIZE {
			$y = $y + speed
//inf droite vers inf gauche
	if $y == WINDOW_YSIZE {
		if $x > -WINDOW_XSIZE {
			$x = $x - speed
//inf gauche vers sup gauche
	if $x == -WINDOW_XSIZE {
		if $y != -WINDOW_YSIZE {
			$y = $y - speed
//sup gauche vers sup droite
	if $y == -WINDOW_YSIZE {
		if $x != WINDOW_XSIZE {
			$x = $x + speed
If I don't touch the screen size, and if I don't use a speed value greater than 10, it works as intended.
However if I change one or the other, this happens

The few things I understand aren't helping me solving the problem. Please help :cry:

To be more precise, it seems like the closer to zero get $x, the smaller gets the value of speed

Nevermind I found the problem, it was just baddly written conditions.