Gamestudio Links
Zorro Links
Newest Posts
No connection to MT4
by JeyKey II. 10/29/26 09:34
Zorro plugin for Hyperliquid.xyz
by opm. 10/28/26 13:50
Icon "OP"
by JeyKey II. 10/27/26 07:03
ZorroGPT
by TipmyPip. 10/26/26 08:09
Chat Room for Zorro Programmers
by Haitao_Ren. 10/25/26 03:14
Trading Journey
by Haitao_Ren. 10/25/26 03:14
AUM Magazine
Latest Screens
Dorifto samurai
Shadow 2
Rocker`s Revenge
Stug 3 Stormartillery
Who's Online Now
2 registered members (mayarik, LucasJoshua), 8,874 guests, and 2 spiders.
Key: Admin, Global Mod, Mod
Newest Members
Haitao_Ren, JimSimons, julienp, julienper, KelleyAbbey
19247 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