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
3 registered members (Ayumi, NewbieZorro, TipmyPip), 13,888 guests, and 6 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
function with a panel parameter? #253334
02/24/09 04:49
02/24/09 04:49
Joined: Jun 2008
Posts: 19
H
halfpint Offline OP
Newbie
halfpint  Offline OP
Newbie
H

Joined: Jun 2008
Posts: 19
I need to do collision detection between 20 different panels that were created with pan_create so instead of checking each one individually I was going to make a function and use a panel parameter but it doesnt seem to work. It would look something like this.

Code:
function collision_shield(check_pan)
{
	panel* collision = check_pan;
	if((collision.pos_y > 590) && (collision.pos_y < 610))// not the entire check
	{
		return(true);
	}
	return(false);
}


This doesn't work for multiple reasons and I cant seem to get it to work, please help. When i run this i get an error of empty pointer in function.

Last edited by halfpint; 02/24/09 04:51.
Re: function with a panel parameter? [Re: halfpint] #253337
02/24/09 05:16
02/24/09 05:16
Joined: Oct 2004
Posts: 1,655
T
testDummy Offline
Serious User
testDummy  Offline
Serious User
T

Joined: Oct 2004
Posts: 1,655
No local PANEL pointer(*) declarations in C-Script (.wdl)?


Code:
PANEL* collision; // <- name collision?
function collision_shield(check_pan)
{
	if (check_pan == 0) { return(0); }
	//if (check_pan == 0) { error("collision_shield(0)");  return(0); }
	collision = check_pan;
	if((collision.pos_y > 590) && (collision.pos_y < 610))// not the entire check
	{
		return(true);
	}
	return(false);
}


Last edited by testDummy; 02/24/09 17:11.
Re: function with a panel parameter? [Re: testDummy] #253339
02/24/09 06:10
02/24/09 06:10
Joined: Jun 2008
Posts: 19
H
halfpint Offline OP
Newbie
halfpint  Offline OP
Newbie
H

Joined: Jun 2008
Posts: 19
ok thanks, i must have messed up somewhere else in my code. Would someone be so kind as to help me with my project? I know I am making it way more complicated then it should be. All i want to do is create an asteroid every 2 seconds until there is a max of twenty of asteroids. Have them fall towards the bottom and near the bottom is a paddle ( like a pong paddle ) that when an asteroid hits the paddle the asteroid is destroyed and another one with be created. I have been able to create the twenty asteroids and have them fall to the bottom, move the paddle and have the asteroids deleted once they left the screen and be created back at the top, but once i tried collisions it messed everything up. Also I dont think what i just said should take the 419 lines I have used so far but that is just me. I could post my code so far just not sure if i should.


Moderated by  HeelX, Lukas, rayp, Rei_Ayanami, Superku, Tobias, TWO, VeT 

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