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
Data from CSV not parsed correctly
by dr_panther. 05/06/24 18:50
AUM Magazine
Latest Screens
The Bible Game
A psychological thriller game
SHADOW (2014)
DEAD TASTE
Who's Online Now
1 registered members (henrybane), 1,499 guests, and 1 spider.
Key: Admin, Global Mod, Mod
Newest Members
LucasJoshua, Baklazhan, Hanky27, firatv, wandaluciaia
19054 Registered Users
Previous Thread
Next Thread
Print Thread
Rate Thread
Character can't jump, gives error #299751
11/26/09 16:46
11/26/09 16:46
Joined: Oct 2009
Posts: 90
WickWoody Offline OP
Junior Member
WickWoody  Offline OP
Junior Member

Joined: Oct 2009
Posts: 90
As I mentioned in the title, the code returns an error. I wrote the code below. What's wrong?

Code:
action oyuncu()
{
	VECTOR* hareket_vektoru;
	VECTOR* ilk;
	VECTOR* son;
	var anim;
	var yukseklik = 0;
	
	hareket_vektoru.x = 0;
	hareket_vektoru.y = 0;
	hareket_vektoru.z = 0;
	while(1)
	{
		my.durum = bekle;
		if(key_cur == 1)
		{
			my.pan = 0;
			my.durum = yuru;
		}
		if(key_cul == 1)
		{
			my.pan = 180;
			my.durum = yuru;
		}
		if(my.durum == yuru)
		{
			hareket_vektoru.x = 5*time_step;
			ent_animate(me, "walk", anim, ANM_CYCLE);
		}
		if(my.durum == bekle)
		{
			hareket_vektoru.x = 0;
			ent_animate(me, "stand", anim, ANM_CYCLE);
		}
		anim += 5 * time_step;
		camera.x = my.x;
		camera.z = my.z;
		camera.y = me.y - 475;
		camera.pan = 90;
// STARTS HERE
		 vec_set(ilk.z, my.z);
		vec_set(son.z, my.z);
		son.z = -5000;
		yukseklik = c_trace(ilk, son, IGNORE_ME|IGNORE_PASSABLE|USE_BOX);
		if(key_cuu == 1)
		{
			if(yukseklik < 2)
			{
				yukseklik = 1;
				hareket_vektoru.z = 12;
			}
		}
		if(yukseklik > 0)
		{
			hareket_vektoru.z -= 3*time_step;
			my.durum = zipla;
			if(hareket_vektoru.z < (yukseklik * -1))
			{
				hareket_vektoru.z = yukseklik * -1;
			}
		} else {
			my.durum = bekle;
			hareket_vektoru.z = -1 * yukseklik;
		}
// ENDS HERE
		c_move(me, hareket_vektoru, nullvector, GLIDE|USE_BOX);
		wait(1);
	}
}



(Crash in oyuncu)
Quadraxas, the more waiting for your help. Thanks in advance.

Last edited by WickWoody; 11/26/09 16:46.
Re: Character can't jump, gives error [Re: WickWoody] #299755
11/26/09 17:00
11/26/09 17:00
Joined: Dec 2008
Posts: 1,660
North America
Redeemer Offline
Serious User
Redeemer  Offline
Serious User

Joined: Dec 2008
Posts: 1,660
North America
Code:
vec_set(ilk.z, my.z);
     vec_set(son.z, my.z);



You can't set vectors like this. Vectors start with the "x" value, not the "z" value. Do it like this:

Code:
vec_set(ilk.x, my.x);
     vec_set(son.x, my.x);



Does that fix the problem?

Last edited by Redeemer; 11/26/09 17:01.

Eats commas for breakfast.

Play Barony: Cursed Edition!
Re: Character can't jump, gives error [Re: Redeemer] #299758
11/26/09 17:05
11/26/09 17:05
Joined: Oct 2009
Posts: 90
WickWoody Offline OP
Junior Member
WickWoody  Offline OP
Junior Member

Joined: Oct 2009
Posts: 90
Did not solve the problem. Still the same.

Re: Character can't jump, gives error [Re: WickWoody] #299762
11/26/09 17:47
11/26/09 17:47
Joined: May 2007
Posts: 2,043
Germany
Lukas Offline

Programmer
Lukas  Offline

Programmer

Joined: May 2007
Posts: 2,043
Germany
You're trying to define local VECTOR*s. This does not work like this. By writing VECTOR* hareket_vektoru; you just create a pointer to a vector. You have to define VECTOR*s like this: VECTOR* hareket_vektoru = {x=0; y=0; z=0;} OUTSIDE your function. If it needs to be a local VECTOR*, VECTOR hareket_vektoru; (without *) should work.

Re: Character can't jump, gives error [Re: Lukas] #299763
11/26/09 17:51
11/26/09 17:51
Joined: Oct 2009
Posts: 90
WickWoody Offline OP
Junior Member
WickWoody  Offline OP
Junior Member

Joined: Oct 2009
Posts: 90
Thanks, it's work !


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