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
2 registered members (AndrewAMD, 1 invisible), 1,395 guests, and 12 spiders.
Key: Admin, Global Mod, Mod
Newest Members
AemStones, LucasJoshua, Baklazhan, Hanky27, firatv
19055 Registered Users
Previous Thread
Next Thread
Print Thread
Rate Thread
Simple Gravity #200363
04/03/08 17:59
04/03/08 17:59
Joined: Oct 2007
Posts: 116
S
sydan Offline OP
Member
sydan  Offline OP
Member
S

Joined: Oct 2007
Posts: 116
Does any one have any suggestions for a simple easy short code gravity system that works effectively? I need the objects to fall but also be able to slide along the floor and down slopes under gravity.

If youve got any ideas please reply.

Sydan


For some reason, my ambition always seems to beat my ability.
Re: Simple Gravity [Re: sydan] #200450
04/04/08 06:42
04/04/08 06:42
Joined: Apr 2005
Posts: 3,815
Finland
Inestical Offline
Rabbit Developer
Inestical  Offline
Rabbit Developer

Joined: Apr 2005
Posts: 3,815
Finland
this is something from my head:

 Code:
...
var zForce;
...
action player()
{
...
	vec_set(temp, my.x);
	temp.z -= 4000;
	c_scan(my.x, temp, IGNORE_ME | IGNORE_PASSABLE);

	if(result <= 32)
	{
		zForce = 0;
	}
	else
	{
		zForce += 6.7 * time_step;
		if(zForce >= 9.674)
		{
			zForce = 9.674;
		}
	}
	
	move.z += -zForce;
	c_move(me, move, nullvector, GLIDE | USE_AABB);

	vec_set(temp, my.x);
	temp.z -= 4000;
	c_scan(my.x, temp, IGNORE_ME | IGNORE_PASSABLE | GLIDE);

	if(result >= 0)
	{
		my.z += result*time_step;
	}
...
}


I'd be surprised if it works, but basically it goes somewhat like that.


"Yesterday was once today's tomorrow."

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