Gamestudio Links
Zorro Links
Newest Posts
Change chart colours
by 7th_zorro. 05/11/24 09:25
Data from CSV not parsed correctly
by dr_panther. 05/06/24 18:50
Help with plotting multiple ZigZag
by degenerate_762. 04/30/24 23:23
AUM Magazine
Latest Screens
The Bible Game
A psychological thriller game
SHADOW (2014)
DEAD TASTE
Who's Online Now
2 registered members (AndrewAMD, 1 invisible), 1,086 guests, and 5 spiders.
Key: Admin, Global Mod, Mod
Newest Members
firatv, wandaluciaia, Mega_Rod, EternallyCurious, howardR
19050 Registered Users
Previous Thread
Next Thread
Print Thread
Rate Thread
Collision pointer #315884
03/19/10 19:10
03/19/10 19:10
Joined: Aug 2009
Posts: 49
USA, South Carolina.
Silence_ Offline OP
Newbie
Silence_  Offline OP
Newbie

Joined: Aug 2009
Posts: 49
USA, South Carolina.
Lately I’ve been thinking it would be really useful to have a pointer that handles collisions in 2d games. I'm still a beginner in programming so I don't know how to make one.
This is what it looks like now.

Code:
//collision.h
#ifndef collision_h
#define collision_h

#define STOP (1<<0)
#define BOUNCE (1<<1)
#define CUSTOME (1<<2)

typedef struct COLLISION
{
	long flags;
} COLLISION;

#endif



This is how I want it to look like when someone wants to use it.
Code:
COLLISION* test =
{
	Flags = STOP | BOUNCE | CUSTOM;
	Panel 1 = ?;
	Panel 2 = ?;
	Function  = action();
}



BOUNCE makes the panel bounce when it collides with another panel.
STOP makes the panel stop when it collides with another panel.
CUSTOM makes the panel do what the function attached to it says to do when it collides with another panel.

So can anyone help me make this work, because I have know idea where to go from here.
When its finished and working I’ll put it in the download section.


If "Pro" is the opposite of "Con", then is progress the opposite of congress?
Re: Collision pointer [Re: Silence_] #315929
03/20/10 09:42
03/20/10 09:42
Joined: Jul 2002
Posts: 4,436
Germany, Luebeck
Xarthor Offline
Expert
Xarthor  Offline
Expert

Joined: Jul 2002
Posts: 4,436
Germany, Luebeck
Sorry if the following response is of no help to you:

Before thinking about how to implement it, you should rather think about the whole process.
I mean, how to you link a panel to that struct?
Panel collision can just be done by checking one panels position and size again other panels (or is there a new feature I'm unaware of?)
Now, how do you find out which struct to "use"?

<edit>
Another problem: afaik you cannot use "function pointers". Thus saving a link to a function in some property is not possible. But I might be wrong.
</edit>

I'm not quite sure if the way you want to go is the best way for this kind of problem.

Last edited by Xarthor; 03/20/10 09:44.
Re: Collision pointer [Re: Xarthor] #316052
03/21/10 02:45
03/21/10 02:45
Joined: Aug 2009
Posts: 49
USA, South Carolina.
Silence_ Offline OP
Newbie
Silence_  Offline OP
Newbie

Joined: Aug 2009
Posts: 49
USA, South Carolina.
Thats too bad. I guess I'll just have to write out the code myself. thanks for the help.


If "Pro" is the opposite of "Con", then is progress the opposite of congress?
Re: Collision pointer [Re: Silence_] #316075
03/21/10 10:10
03/21/10 10:10
Joined: Jul 2007
Posts: 959
nl
F
flits Offline
User
flits  Offline
User
F

Joined: Jul 2007
Posts: 959
nl


"empty"

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

Gamestudio download | chip programmers | 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