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
4 registered members (NewbieZorro, Grant, TipmyPip, AndrewAMD), 13,346 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
panel collision #187230
03/06/08 03:25
03/06/08 03:25
Joined: Jun 2004
Posts: 12
cweth Offline OP
Newbie
cweth  Offline OP
Newbie

Joined: Jun 2004
Posts: 12
I have a game where letter panels float down the screen, and they can either be shot with a missile or captured with a bubble to spell a word.

The problem i am having is that the collisions of the panels are not being detected very well. The missile will float well past the letters and then blow them up, or not detect at all.

all of the letters are their own panels, and there are 43 letters in the alphabet, and i use text.string arrays to cycle through the numbers to see if the letter has been hit. i use these strings to make statements that retrieve the coords of the letter panels, and compare the location with the location of the missile. This is only the portion of code where the missile collision is detected. The bubble detection is nearly identical.

the pos_y_array contains strings like "g1w_letter_pan.pos_y" to direct the code to each letter's pos_y, and pos_x_array is the same

enemy_pan_x_num and y_num are variables that take the x and y coords out of each letter panel, and use it to compare its position with the missile panel.


Code:
 

function set_collisions ()
{

collision_loop_count = 0;
while(missile_pan.pos_x != 1200)
{

if (collision_loop_count >= 42)
{
collision_loop_count = 0;
}

str_cpy(collision_string, "enemy_pan_x_num = ");
str_cat(collision_string, pos_x_array.string[collision_loop_count]);
str_cat(collision_string, ";");
execute(collision_string);

str_cpy(collision_string2, "enemy_pan_y_num = ");
str_cat(collision_string2, pos_y_array.string[collision_loop_count]);
str_cat(collision_string2, ";");
execute(collision_string2);


if (enemy_pan_x_num <= missile_pan.pos_x + 100
&& missile_pan.visible == on
&& enemy_pan_x_num >= missile_pan.POS_X - 125
&& enemy_pan_y_num >= missile_pan.POS_Y - 100) // enemy is hit
{
this part makes the ship dissappear and blow up, and start its path again.
break;


}
collision_loop_count += 1;
WAIT(1);

}
}



can someone please help me figure out how to make sure the collisions are detected in real time, and accurately?

Last edited by cweth; 03/06/08 17:11.
Re: panel collision [Re: cweth] #187231
03/06/08 16:51
03/06/08 16:51
Joined: Jun 2004
Posts: 12
cweth Offline OP
Newbie
cweth  Offline OP
Newbie

Joined: Jun 2004
Posts: 12
maybe i'm not explaining myself very well. I want to know why the missle panel floats right passed the letter panels without blowing them up, and then much further along it's path, the missile will detect collision with the letter, and then blow it up.
Does anyone know a why this is happening? or does anyone know a better way for mne to detect collisions?

Re: panel collision [Re: cweth] #187232
03/09/08 05:29
03/09/08 05:29
Joined: Jun 2004
Posts: 12
cweth Offline OP
Newbie
cweth  Offline OP
Newbie

Joined: Jun 2004
Posts: 12
I was just making too many unneccessary processes, i managed to minimize them by making the collision check at the same time i moved the letters down the screen.

Re: panel collision [Re: cweth] #187233
03/09/08 21:09
03/09/08 21:09
Joined: Jun 2003
Posts: 427
Prison
DarkWhoppy_ Offline
Senior Member
DarkWhoppy_  Offline
Senior Member

Joined: Jun 2003
Posts: 427
Prison
Good call. :-)

Nothing wrong with examining your own code.


darkwhoppy@msn.no.spam.com (remove no.spam.) Website: WhoppyArts

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