Gamestudio Links
Zorro Links
Newest Posts
M1 Oversampling
by Petra. 04/24/24 10:34
Zorro FIX plugin - Experimental
by flink. 04/21/24 07:12
Data from CSV not parsed correctly
by EternallyCurious. 04/20/24 21:39
Scripts not found
by juergen_wue. 04/20/24 18:51
zorro 64bit command line support
by 7th_zorro. 04/20/24 10:06
StartWeek not working as it should
by jcl. 04/20/24 08:38
folder management functions
by VoroneTZ. 04/17/24 06:52
AUM Magazine
Latest Screens
The Bible Game
A psychological thriller game
SHADOW (2014)
DEAD TASTE
Who's Online Now
4 registered members (PeWi, AndrewAMD, Quad, VoroneTZ), 463 guests, and 5 spiders.
Key: Admin, Global Mod, Mod
Newest Members
Mega_Rod, EternallyCurious, howardR, 11honza11, ccorrea
19048 Registered Users
Previous Thread
Next Thread
Print Thread
Rate Thread
bounce of exact 180 degree #455078
10/07/15 15:51
10/07/15 15:51
Joined: Jul 2001
Posts: 4,801
netherlands
Realspawn Offline OP

Expert
Realspawn  Offline OP

Expert

Joined: Jul 2001
Posts: 4,801
netherlands
I am trying to make my character turn exactly 180 degree every time it walks against a level block or entity I found this in the manual.

Code:
action walking_enemy()
{
	set(my,SHADOW | METAL);
	c_setminmax(my);

	my.skill100 =100;
	while(1)
	{	
		c_move (my, vector (10* time_step,0,0), nullvector, IGNORE_PASSABLE | NULL);
		my.skill22 += 8 * time_step; // 5 gives the "walk" animation speed
		ent_animate(my, "walk", my.skill22, ANM_CYCLE);
		if (trace_hit) { 
			vec_to_angle(my.pan,bounce); // and bounce off any obstacles
			my.tilt = 0;
			my.roll =0;
			
		} 
		wait(1);
	}
}



I tried adding my.pan -=180 but no effect sometimes it seems to work
but then suddenly he walks a random direction instead of right back ? aniy idea


Find all my tutorials & Workshops at : www.rp-interactive.nl

Creativity starts in the brain
Re: bounce of exact 180 degree [Re: Realspawn] #455081
10/07/15 19:37
10/07/15 19:37
Joined: Nov 2007
Posts: 2,568
Germany, BW, Stuttgart
MasterQ32 Offline
Expert
MasterQ32  Offline
Expert

Joined: Nov 2007
Posts: 2,568
Germany, BW, Stuttgart
Code:
vec_to_angle(my.pan,bounce); // and bounce off any obstacles


should be replaced with
Code:
my.pan += 180;


no additional bouncing wink


Visit my site: www.masterq32.de
Re: bounce of exact 180 degree [Re: MasterQ32] #455084
10/08/15 02:51
10/08/15 02:51
Joined: Jul 2001
Posts: 4,801
netherlands
Realspawn Offline OP

Expert
Realspawn  Offline OP

Expert

Joined: Jul 2001
Posts: 4,801
netherlands
dang it it was that simple lol thank you laugh


Find all my tutorials & Workshops at : www.rp-interactive.nl

Creativity starts in the brain

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