Gamestudio Links
Zorro Links
Newest Posts
AlpacaZorroPlugin v1.3.0 Released
by kzhao. 05/22/24 13:41
Free Live Data for Zorro with Paper Trading?
by AbrahamR. 05/18/24 13:28
Change chart colours
by 7th_zorro. 05/11/24 09:25
AUM Magazine
Latest Screens
The Bible Game
A psychological thriller game
SHADOW (2014)
DEAD TASTE
Who's Online Now
3 registered members (AndrewAMD, Akow, degenerate_762), 1,430 guests, and 9 spiders.
Key: Admin, Global Mod, Mod
Newest Members
AemStones, LucasJoshua, Baklazhan, Hanky27, firatv
19055 Registered Users
Previous Thread
Next Thread
Print Thread
Rate Thread
Bounce each other #324705
05/22/10 19:08
05/22/10 19:08
Joined: Nov 2008
Posts: 50
S
Secret_V Offline OP
Junior Member
Secret_V  Offline OP
Junior Member
S

Joined: Nov 2008
Posts: 50
I'm trying to make a bouncing game over the network. So what I'm trying to do is, when you bounce against an other player, he bounces off in the opposite direction. But it's not working properly... This is what I'm trying to do:

In the character action
Code:
c_move(my, vector(my.skill33 * time_step, 0, my.skill33 * time_step * sign(my.skill33)), vector(my.skill36, my.skill37, -5 * time_step), GLIDE);
my.pan += my.skill34 * time_step;
ent_sendnow(my);
my.skill41 = my.x;
my.skill42 = my.y;



The impact function:
Code:
void bounce_off()
{
	if(event_type == EVENT_IMPACT)
	{
		you.skill36 = my.x - my.skill41;
		you.skill37 = my.y - my.skill45;
	}
}



But something's going wrong... Mostly, nothing happens, but then, all of a sudden, the other character is in the corner of the level...

Any idea's anyone? Or to how I can do it in a different way perhaps?

Re: Bounce each other [Re: Secret_V] #324779
05/23/10 11:12
05/23/10 11:12
Joined: Sep 2003
Posts: 6,861
Kiel (Germany)
Superku Offline
Senior Expert
Superku  Offline
Senior Expert

Joined: Sep 2003
Posts: 6,861
Kiel (Germany)
There is a predefined vector bounce (=> vec_to_angle(my.pan, bounce)), maybe that's what you are looking for.


"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: Bounce each other [Re: Superku] #324790
05/23/10 11:48
05/23/10 11:48
Joined: Nov 2008
Posts: 50
S
Secret_V Offline OP
Junior Member
Secret_V  Offline OP
Junior Member
S

Joined: Nov 2008
Posts: 50
I tried that already, but that one rotates my character and I don't want that.

Re: Bounce each other [Re: Secret_V] #324793
05/23/10 11:55
05/23/10 11:55
Joined: Sep 2003
Posts: 6,861
Kiel (Germany)
Superku Offline
Senior Expert
Superku  Offline
Senior Expert

Joined: Sep 2003
Posts: 6,861
Kiel (Germany)
Rotate a temporary vector instead and add this one to your movement code.


"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: Bounce each other [Re: Superku] #324794
05/23/10 12:06
05/23/10 12:06
Joined: Nov 2008
Posts: 50
S
Secret_V Offline OP
Junior Member
Secret_V  Offline OP
Junior Member
S

Joined: Nov 2008
Posts: 50
How, exactly? Rotate the temporary vector with bounce or something?

Re: Bounce each other [Re: Secret_V] #324796
05/23/10 12:10
05/23/10 12:10
Joined: Mar 2008
Posts: 2,247
Baden Württemberg, Germany
Espér Offline
Expert
Espér  Offline
Expert

Joined: Mar 2008
Posts: 2,247
Baden Württemberg, Germany
VECTOR* my_move = nullvector;
...
c_move(my, nullvector, my_move, GLIDE)
if(trace_hit)
{
vec_to_angle(my_move, bounce)
}


i think like this ^^
I used that by myself for my Arkanoid testings ^^


Selling my Acknex Engine Editions (A7 Com & A8 Pro):
>> click here if you are interested <<
Re: Bounce each other [Re: Espér] #324802
05/23/10 13:10
05/23/10 13:10
Joined: Nov 2008
Posts: 50
S
Secret_V Offline OP
Junior Member
Secret_V  Offline OP
Junior Member
S

Joined: Nov 2008
Posts: 50
It's not really working...I tried different things:

VECTOR* my_move = nullvector;

c_move(my, vector(my.skill33 * time_step, 0, my.skill33 * time_step * sign(my.skill33)), vector(my_move.x * time_step, my_move.y * time_step, -5 * time_step), GLIDE); // Tried this with and without the time_step

if(event_type == EVENT_IMPACT)
{
vec_set(my_move.x, my.pan); //Added this one later
vec_to_angle(my_move, bounce); //First only with this one
vec_set(my_move.x, nullvector); //Added this when characters kept moving
}

Now then, when the two characters hit each other, one of them just shoots away until it hits the wall and then they both keep moving slowly to the right... Even though my_move has been set to zero. Also, it doesn't bounce off in the direction the one that hits him is facing... frown


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