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
4 registered members (M_D, AndrewAMD, Quad, Ayumi), 806 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
how to attach sprite entity to model? #311008
02/18/10 07:53
02/18/10 07:53
Joined: Dec 2009
Posts: 71
N
ncc1701d Offline OP
Junior Member
ncc1701d  Offline OP
Junior Member
N

Joined: Dec 2009
Posts: 71
can someone show me how to attach a sprite entity to the model?

my attempt was doing it like a camera but this may be wrong.
I think using vectors is wrong but Iam not sure of the alternative.
This crashes in attach_entity()

here are the key parts below
thanks

////////////////////////////
void attach_entity();


box = ent_create ("boat.mdl", vector(-400, 0, 570), attach_entity); //

ent_explo = ent_create("flash+3.tga", vector(-200, 0, 0), lightcolor);



void attach_entity()
{
while(1)
{
vec_set(ent_explo.x,my.x);
vec_set(ent_explo.y,my.y);
vec_set(ent_explo.z,my.z);
wait(1);
}
}

Re: how to attach sprite entity to model? [Re: ncc1701d] #311012
02/18/10 08:12
02/18/10 08:12
Joined: Jul 2003
Posts: 893
Melbourne, Australia
Matt_Coles Offline

User
Matt_Coles  Offline

User

Joined: Jul 2003
Posts: 893
Melbourne, Australia
haven't tested it, but it should be something similar to this:


var timetocallsprite;

function yourscript()
{
while(1)
{
if (timetocallsprite == 1)
{
ent_create ("yourpic.tga", vector(my.x,my.y,my.z), youraction);
}
wait(1);
}
}


Re: how to attach sprite entity to model? [Re: ncc1701d] #311013
02/18/10 08:12
02/18/10 08:12
Joined: Apr 2006
Posts: 624
DEEP 13
badapple Offline
User
badapple  Offline
User

Joined: Apr 2006
Posts: 624
DEEP 13
nevermind matt got ya at the same time

Last edited by badapple; 02/18/10 08:14.
Re: how to attach sprite entity to model? [Re: badapple] #311021
02/18/10 09:13
02/18/10 09:13
Joined: Jul 2003
Posts: 893
Melbourne, Australia
Matt_Coles Offline

User
Matt_Coles  Offline

User

Joined: Jul 2003
Posts: 893
Melbourne, Australia
I have to say awesome team tag work there on our behalfs badapple! grin

Re: how to attach sprite entity to model? [Re: Matt_Coles] #311490
02/20/10 00:57
02/20/10 00:57
Joined: Dec 2009
Posts: 71
N
ncc1701d Offline OP
Junior Member
ncc1701d  Offline OP
Junior Member
N

Joined: Dec 2009
Posts: 71
what is wrong with how I applyed what said?
I just took the sample moving ball from the the tutorial.
You can sub my tga with anything if you want to test it out.
I was trying to attach the entity to the ball.



///////////////////////////////////////////////////////////////
#include <acknex.h>
#include <default.c>
#include <atypes.h>
///////////////////////////////////////////////////////////////

VECTOR ball_force;
ENTITY* ball;
var timetocallsprite;
BMAP* bmp_explo = "thrpink3+3.tga";
ENTITY* ent_explo;


function yourscript()
{
while(1)
{
if (timetocallsprite == 1)
{
ent_create("thpink+3.tga", vector(my.x, my.y, my.z), NULL);
ent_explo.roll = 0.001;
}
wait(1);
}
}


function main()
{
level_load("roller.wmb");
ball = ent_create ("ball.mdl", vector(-400, 0, 100), yourscript);
ph_setgravity (vector(0, 0, -386));
phent_settype (ball, PH_RIGID, PH_SPHERE);
phent_setmass (ball, 3, PH_SPHERE);
phent_setfriction (ball, 80);
phent_setdamping (ball, 40, 40);
phent_setelasticity (ball, 50, 20);
while (1)
{
ball_force.x = 150 * time_step * (key_cur - key_cul);
ball_force.y = 150 * time_step * (key_cuu - key_cud);
ball_force.z = 0; //
phent_addtorqueglobal (ball, ball_force);
camera.x = ball.x - 300;
camera.y = ball.y;
camera.z = 1000;
camera.tilt = -60;
wait (1);
}
}


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