Welcome Guest [Log In] [Register]
We hope you enjoy your visit.


You're currently viewing the Ultimate 3D Community as a guest. This means that you can only read posts, but can not create posts or topics by yourself. To be able to post you need to register. Then you can participate in the community active and use many member-only features such as customizing your profile, sending personal messages, and voting in polls. Registration is simple, fast, and completely free.

Join our community!

If you are already a member please log in to your account to access all of our features:

Username:   Password:
Add Reply
How to make billboard enemies.; Like in old fps games like doom.
Topic Started: Jul 5 2006, 08:38 AM (348 Views)
57E
Member Avatar
Forum Leader
[ *  *  *  *  * ]
I have no clue how this can be done. I’m simply need code that changes billboard's texture when camera see it in different directions, and variable to set billboard enemy's facing direction. If someone have code for this please post it. :(

Offline Profile Quote Post Goto Top
 
Dr. Best
Member Avatar
Administrator
[ *  *  *  *  *  * ]
No problem ^_^ :
Code:
 
// This code is to be used in the step event of the enemy

// Calculate the view angle of the camera to the enemy
view_angle=point_direction(enemy.x,enemy.y,camera.x,camera.y);
// view_direction is a variable that describes which direction the enemy looks at
view_angle-=view_direction;
// Bring view_angle in the range from 0 to 360
while(view_angle>360){
   view_angle-=360;
}
while(view_angle<0){
   view_angle+=360;
}
// Set up the texture that matchs the calculated degree
if(view_angle>=0 && view_angle<45){
   texture=10;
}
else if(view_angle>=45 && view_angle<90){
   texture=11;
}
else if(view_angle>=90 && view_angle<135){
   texture=12;
}
else if(view_angle>=135 && view_angle<180){
   texture=13;
}
else if(view_angle>=180 && view_angle<225){
   texture=14;
}
else if(view_angle>=225 && view_angle<270){
   texture=15;
}
else if(view_angle>=270 && view_angle<315){
   texture=16;
}
else if(view_angle>=315 && view_angle<360){
   texture=17;
}
Offline Profile Quote Post Goto Top
 
57E
Member Avatar
Forum Leader
[ *  *  *  *  * ]
Thank you very much! :thumb_up: You are the best.

Offline Profile Quote Post Goto Top
 
« Previous Topic · Questions about Ultimate 3D · Next Topic »
Add Reply