Gamestudio Links
Zorro Links
Newest Posts
Zorro 2.70
by jcl. 09/29/25 09:24
optimize global parameters SOLVED
by dBc. 09/27/25 17:07
ZorroGPT
by TipmyPip. 09/27/25 10:05
assetHistory one candle shift
by jcl. 09/21/25 11:36
Plugins update
by Grant. 09/17/25 16:28
AUM Magazine
Latest Screens
Rocker`s Revenge
Stug 3 Stormartillery
Iljuschin 2
Galactic Strike X
Who's Online Now
0 registered members (), 18,561 guests, and 5 spiders.
Key: Admin, Global Mod, Mod
Newest Members
krishna, DrissB, James168, Ed_Love, xtns
19168 Registered Users
Previous Thread
Next Thread
Print Thread
Rate Thread
Getting crash while using panels #442477
06/23/14 13:22
06/23/14 13:22
Joined: Nov 2010
Posts: 7
Sweden
J
jakk_zeven Offline OP
Newbie
jakk_zeven  Offline OP
Newbie
J

Joined: Nov 2010
Posts: 7
Sweden
Im programming a very simple pongclone for learning purposes and I got a bit of a problem . As soon as I uncomment the ball panel it crashes, but when I comment the flagsline it works again(although no visible ball). It is really strange. At first I thought it crashed because of me using the same bitmap for both paddle panels, but it made no difference when I defined two BMAPs. I even tried different sizes of the imagefile since it worked when I used the paddleimage. I have tried 32x32, 64x64 and 128x128 for the ball.

Otherwise it works fine.

Code:
#include <acknex.h>
#include <default.c>

BMAP* paddle = "paddle.png";
BMAP* ball = "balls.png";
BMAP* paddletwo = "paddle.png";

PANEL* paddle_one =
{
	bmap = paddle;
	pos_x = 64;
	pos_y =250;
	layer = 1;
	flags = SHOW;
}

PANEL* paddle_two =
{
	bmap = paddletwo;
	pos_x = 736;
	pos_y = 250;
	layer = 1;
	flags = SHOW;
}


//PANEL* ball =
//{
//	bmap = ball;
//	pos_x = 400;
//	pos_y = 350;       CRASHES WHEN USED!
//	layer = 2;
//	flags = SHOW;
//}

function player_one()
{
	if (key_w)
	{
		if (paddle_one.pos_y > 0)
		{
			paddle_one.pos_y -= 1;
			wait(1);
		}
	}
	if (key_s)
	{
		if (paddle_one.pos_y < 500)
		{
			paddle_one.pos_y += 1;
			wait(1);
		}
	}
	wait(1);
}

function player_two()
{
	if (key_pgup)
	{
		if (paddle_two.pos_y > 0)
		{
			paddle_two.pos_y -= 1;
			wait(1);
		}
	}
	
	if (key_pgdn)
	{
		if (paddle_two.pos_y < 500)
		{
			paddle_two.pos_y += 1;
			wait(1);
		}
	}
}

function main()
{
	screen_size.x = 800;
	screen_size.y = 600;
	while(1)
	{
		player_one();
		player_two();
		wait(1);
	}
	
}


Re: Getting crash while using panels [Re: jakk_zeven] #442478
06/23/14 13:33
06/23/14 13:33
Joined: Sep 2003
Posts: 6,861
Kiel (Germany)
Superku Offline
Senior Expert
Superku  Offline
Senior Expert

Joined: Sep 2003
Posts: 6,861
Kiel (Germany)
Use separate names for PANELs and BMAPs (or any other objects in general), for example bmp_ball and pnl_ball.


"Falls das Resultat nicht einfach nur dermassen gut aussieht, sollten Sie nochmal von vorn anfangen..." - Manual

Check out my new game: Pogostuck: Rage With Your Friends
Re: Getting crash while using panels [Re: Superku] #442480
06/23/14 13:36
06/23/14 13:36
Joined: Nov 2010
Posts: 7
Sweden
J
jakk_zeven Offline OP
Newbie
jakk_zeven  Offline OP
Newbie
J

Joined: Nov 2010
Posts: 7
Sweden
That did the trick! Thank you laugh


Gamestudio download | Zorro platform | shop | Data Protection Policy

oP group Germany GmbH | Birkenstr. 25-27 | 63549 Ronneburg / Germany | info (at) opgroup.de

Powered by UBB.threads™ PHP Forum Software 7.7.1