Gamestudio Links
Zorro Links
Newest Posts
Trading Journey
by M_D. 04/26/24 20:22
Help with plotting multiple ZigZag
by M_D. 04/26/24 20:03
Data from CSV not parsed correctly
by jcl. 04/26/24 11:18
M1 Oversampling
by jcl. 04/26/24 11:12
Why Zorro supports up to 72 cores?
by jcl. 04/26/24 11:09
Eigenwerbung
by jcl. 04/26/24 11:08
MT5 bridge not working on MT5 v. 5 build 4160
by EternallyCurious. 04/25/24 20:49
Zorro FIX plugin - Experimental
by flink. 04/21/24 07:12
AUM Magazine
Latest Screens
The Bible Game
A psychological thriller game
SHADOW (2014)
DEAD TASTE
Who's Online Now
1 registered members (AndrewAMD), 805 guests, and 5 spiders.
Key: Admin, Global Mod, Mod
Newest Members
wandaluciaia, Mega_Rod, EternallyCurious, howardR, 11honza11
19049 Registered Users
Previous Thread
Next Thread
Print Thread
Rate Thread
camera follow #446767
10/30/14 13:10
10/30/14 13:10
Joined: Oct 2014
Posts: 4
J
joe__p Offline OP
Guest
joe__p  Offline OP
Guest
J

Joined: Oct 2014
Posts: 4
I am making a maze game for my class and I am trying to make the camera follow the ball from behind to see better around corners and near walls but I cant get it right. any ideas??

Re: camera follow [Re: joe__p] #446768
10/30/14 13:12
10/30/14 13:12
Joined: Jul 2001
Posts: 4,801
netherlands
Realspawn Offline

Expert
Realspawn  Offline

Expert

Joined: Jul 2001
Posts: 4,801
netherlands
Perhaps you can use this laugh

Code:
action my_player()
{
var movement_speed = 10; // movement speed
var walk_percentage;
var stand_percentage;
VECTOR temp;
player = my; // I'm the player
while (1)
{
player.pan -= 5 * mouse_force.x * time_step; // rotate the player using the mouse
if(!key_w && !key_s) // the player isn't moving at all?
{
ent_animate(my, "stand", stand_percentage, ANM_CYCLE); // then play its "stand" animation
stand_percentage += 5 * time_step; // 5 = animation speed
}
else // the player is moving?
{
ent_animate(my, "walk", walk_percentage, ANM_CYCLE); // then play its "walk" animation
walk_percentage += 6 * time_step; // 6 = animation speed
}
camera.x = player.x - 250 * cos(player.pan);
camera.y = player.y - 250 * sin(player.pan);
camera.pan = player.pan; // the camera and the player have the same pan angle
camera.z = player.z + 150; // place the camera above the player, play with this value
camera.tilt = -25;
temp.x = movement_speed * (key_w - key_s) * time_step;
temp.y = movement_speed * (key_a - key_d) * 0.6 * time_step;
temp.z = 0;
c_move (my, temp.x, nullvector, IGNORE_PASSABLE | GLIDE);
wait (1);
}
}


Last edited by Realspawn; 10/30/14 13:13.

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

Creativity starts in the brain
Re: camera follow [Re: Realspawn] #446769
10/30/14 13:13
10/30/14 13:13
Joined: Oct 2014
Posts: 4
J
joe__p Offline OP
Guest
joe__p  Offline OP
Guest
J

Joined: Oct 2014
Posts: 4
How would I attach that action to my ball entity? It isn't placed into the maze with the world editor its placed in my code.

Re: camera follow [Re: joe__p] #446771
10/30/14 13:40
10/30/14 13:40
Joined: Jul 2001
Posts: 4,801
netherlands
Realspawn Offline

Expert
Realspawn  Offline

Expert

Joined: Jul 2001
Posts: 4,801
netherlands
I imagine you gave your ball an action simply add the cam code
to that action laugh

Code:
}
camera.x = player.x - 250 * cos(player.pan);
camera.y = player.y - 250 * sin(player.pan);
camera.pan = player.pan; // the camera and the player have the same pan angle
camera.z = player.z + 150; // place the camera above the player, play with this value
camera.tilt = -25;



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

Creativity starts in the brain
Re: camera follow [Re: Realspawn] #446777
10/30/14 17:42
10/30/14 17:42
Joined: Oct 2014
Posts: 4
J
joe__p Offline OP
Guest
joe__p  Offline OP
Guest
J

Joined: Oct 2014
Posts: 4
Thankyou very much!


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