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
1 registered members (TipmyPip), 18,618 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
Page 1 of 2 1 2
calculating vec_dist as part of an action #325736
05/27/10 21:30
05/27/10 21:30
Joined: Apr 2010
Posts: 59
Lagos, Nigeria
gameaddict Offline OP
Junior Member
gameaddict  Offline OP
Junior Member

Joined: Apr 2010
Posts: 59
Lagos, Nigeria
I'm trying to get the location of my player and the ball entity on my level so I can decide if he can move with the ball or not but the vec_dist function causes a crash in the action at the start of the game.

Second problem is that if I don't use the vec_dist, the ball moves with the player but appears at it's original location immediately I release the buttons I assigned to move the ball's x and y positions. Is it because I'm changing x and y positions directly and somehow not making them permanent? How do I set the ball to stop returning to it's former position. I need to make every current location it's location.


I know I can.
Re: calculating vec_dist as part of an action [Re: gameaddict] #325738
05/27/10 22:00
05/27/10 22:00
Joined: Feb 2009
Posts: 2,154
Damocles_ Offline
Expert
Damocles_  Offline
Expert

Joined: Feb 2009
Posts: 2,154
first check for null-pointer problems,
such that one of the entites is not created yet.

Re: calculating vec_dist as part of an action [Re: Damocles_] #325742
05/27/10 22:18
05/27/10 22:18
Joined: Apr 2010
Posts: 59
Lagos, Nigeria
gameaddict Offline OP
Junior Member
gameaddict  Offline OP
Junior Member

Joined: Apr 2010
Posts: 59
Lagos, Nigeria
All the entities are added in WED and assigned their actions. The vec_dist always crashes when it is called any function in which I add it.


I know I can.
Re: calculating vec_dist as part of an action [Re: gameaddict] #325745
05/27/10 22:28
05/27/10 22:28
Joined: Feb 2009
Posts: 2,154
Damocles_ Offline
Expert
Damocles_  Offline
Expert

Joined: Feb 2009
Posts: 2,154
what engine version do you have?

Re: calculating vec_dist as part of an action [Re: Damocles_] #325748
05/27/10 22:50
05/27/10 22:50
Joined: Apr 2010
Posts: 59
Lagos, Nigeria
gameaddict Offline OP
Junior Member
gameaddict  Offline OP
Junior Member

Joined: Apr 2010
Posts: 59
Lagos, Nigeria
The free version. It's the latest one on the download page.


I know I can.
Re: calculating vec_dist as part of an action [Re: gameaddict] #325749
05/27/10 22:51
05/27/10 22:51
Joined: Feb 2009
Posts: 2,154
Damocles_ Offline
Expert
Damocles_  Offline
Expert

Joined: Feb 2009
Posts: 2,154
wich versionnumber?

Anyhow, ver_dist calculates the distance of two vectors.

So it could only "crash" when the vectors or entites refered to are
null.
Not shure if it could crash when the distances are much too long,
but i doubt that.


Re: calculating vec_dist as part of an action [Re: Damocles_] #325751
05/27/10 22:55
05/27/10 22:55
Joined: Apr 2010
Posts: 59
Lagos, Nigeria
gameaddict Offline OP
Junior Member
gameaddict  Offline OP
Junior Member

Joined: Apr 2010
Posts: 59
Lagos, Nigeria
says Gamestudio / Atari lite-C version 7.82


I know I can.
Re: calculating vec_dist as part of an action [Re: gameaddict] #325753
05/27/10 23:09
05/27/10 23:09
Joined: Feb 2009
Posts: 2,154
Damocles_ Offline
Expert
Damocles_  Offline
Expert

Joined: Feb 2009
Posts: 2,154
So its not an outdated version.

best is if you post the sourcecode of that section

Re: calculating vec_dist as part of an action [Re: Damocles_] #325754
05/27/10 23:31
05/27/10 23:31
Joined: Apr 2010
Posts: 59
Lagos, Nigeria
gameaddict Offline OP
Junior Member
gameaddict  Offline OP
Junior Member

Joined: Apr 2010
Posts: 59
Lagos, Nigeria
okay

Here, it's supposed to check the distance between player and the ball and if close enough, call the necessary function but it the action crashes at start

Code:
action theBall()
{
   set(my, SHADOW);
	
	phent_settype(my, PH_RIGID, PH_SPHERE);
	phent_setmass(my, 1, PH_SPHERE);
	phent_setfriction(my,90);
	phent_setelasticity(my,75,100);
	phent_setdamping(my,30,5);
	phent_addvelcentral(my,vector(10,10,0));
	ph_setgravity(vector(0,0,-500));
	
	my.emask |= ENABLE_FRICTION;
	
   	while(1){
   	if(vec_dist(my.x, player.x) < 20){
   		move_with_ball();
      }
   	 
		
		if(key_x){
			kick();
		}
		wait(1);
	}
 }




I know I can.
Re: calculating vec_dist as part of an action [Re: gameaddict] #325755
05/27/10 23:35
05/27/10 23:35
Joined: Oct 2007
Posts: 5,211
İstanbul, Turkey
Quad Offline
Senior Expert
Quad  Offline
Senior Expert

Joined: Oct 2007
Posts: 5,211
İstanbul, Turkey
put
while(!player) wait(1);

at the very begining of the action.


3333333333
Page 1 of 2 1 2

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