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,449 guests, and 6 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
Cant alter object after loading it... #226078
09/07/08 20:04
09/07/08 20:04
Joined: Aug 2008
Posts: 55
United Kingdom
CdeathJD Offline OP
Junior Member
CdeathJD  Offline OP
Junior Member

Joined: Aug 2008
Posts: 55
United Kingdom
Ok so im getting better at Lite-C (I can actually write my own lines of code now. However somethings come up i dont understand... i load an object, and can change its size and position. But none of its red, green, blue (Lite-C seems to think these should be in reverse order :s) or ambient properties work, running this program... the result is a blue background and a white object....
================================================================
#include <acknex.h>
#include <default.c>

ENTITY* FLOOR;

TEXT* Announcement =
{
pos_x = 320;
pos_y = 240;
flags = VISIBLE;
}

function main()
{
video_mode=7;
level_load("");
FLOOR = ent_create ("plain3d.x", vector(-400, 0, 100), NULL); // create the ball
wait(2);
camera.x = 25;
camera.y = 25;
camera.z = 25;
FLOOR.scale_x=5;
FLOOR.z = -5;
FLOOR.red = 0;
FLOOR.green =0;
FLOOR.blue =0;
FLOOR.ambient = 25;
while (1)
{
wait(1);
}
}
================================================================
FYI "plain3d.x" is just a flattened cube (its a shame there isn't simply a "createcube" function like in blitz3d).


I am a noob to this... Blitz3D is where i am best at!
Re: Cant alter object after loading it... [Re: CdeathJD] #226080
09/07/08 20:19
09/07/08 20:19
Joined: Feb 2008
Posts: 3,232
Australia
EvilSOB Offline
Expert
EvilSOB  Offline
Expert

Joined: Feb 2008
Posts: 3,232
Australia
All you are missing is to add in the line
Code:
...
set(FLOOR,LIGHT);
...
and you'll be fine. Its just that the entities LIGHT flag must be ON
for its Red,Green,Blue settings to have any effect.


"There is no fate but what WE make." - CEO Cyberdyne Systems Corp.
A8.30.5 Commercial
Re: Cant alter object after loading it... [Re: EvilSOB] #226082
09/07/08 20:28
09/07/08 20:28
Joined: Aug 2008
Posts: 55
United Kingdom
CdeathJD Offline OP
Junior Member
CdeathJD  Offline OP
Junior Member

Joined: Aug 2008
Posts: 55
United Kingdom
Cheers, not sure why such a thing isnt ON by default, but the code workz now!

Also, how do you make objects in an array like situation.... In blitz 3d you could create a TYPE with arbitrary properties like XVEL,YVEL,ZVEL,ENTITY etc. ENTITY being the important one... you could just put for a BALL type for instance...

"
B.BALL = new ball
B\entity = createsphere()
"

but it seems in lite-C you have to name each and every individual object that exists, and do so independantly :S

I haven't thoroughly read up on arrays yet, but a quick glance showed me nothing that looked helpful!


I am a noob to this... Blitz3D is where i am best at!
Re: Cant alter object after loading it... [Re: CdeathJD] #226086
09/07/08 21:05
09/07/08 21:05
Joined: Nov 2007
Posts: 1,143
United Kingdom
DJBMASTER Offline
Serious User
DJBMASTER  Offline
Serious User

Joined: Nov 2007
Posts: 1,143
United Kingdom
To create your own custom objects, use structs.
Something like...

typedef struct
{
int XVEL;
int YVEL;
int ZVEL;
string* model;
} ball;

Then create them like so...

ball my_ball;

my_ball.XVEL = 15;
my.ball.model = "sphere.mdl";

Hope you get the idea. When lite-c supports classes it should be easier.

Last edited by DJBMASTER; 09/07/08 21:06.
Re: Cant alter object after loading it... [Re: DJBMASTER] #226399
09/09/08 17:05
09/09/08 17:05
Joined: Aug 2008
Posts: 55
United Kingdom
CdeathJD Offline OP
Junior Member
CdeathJD  Offline OP
Junior Member

Joined: Aug 2008
Posts: 55
United Kingdom
I tried what you suggested and it fails with the completely unhelpfull message "sytax error". Heres the code:

=================================================================

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

ENTITY* FLOOR;

typedef struct
{
string* model;
} box; // THIS LINE CAUSES THE PROBLEM, SOME HOW :S

function new_box()
{
box my_box;
my_box.model = "cube.x";
my_box.x = -400;
my_box.y = 0;
my_box.z = 100;
my_box.tilt = 145;
my_box.z = 2800;
my_box.y = -300;
my_box.x = 60;
phent_settype (my_box, PH_RIGID, PH_BOX); // set the physics entity type
phent_setmass (my_box, 3, PH_BOX); // and its mass
phent_setfriction (my_box, 80); // set the friction
phent_setdamping (my_box, 40, 40); // set the damping
phent_setelasticity (my_box, 50, 20); // set the elasticity

}

function main()
{
video_mode=7;
level_load("");
FLOOR = ent_create ("plain3d1.x", vector(-400, 0, 100), NULL); // create the ball
set(FLOOR,LIGHT);
wait(2);
camera.x = 7500;
camera.y = 250;
camera.z = 1250;
camera.pan = 180;
FLOOR.scale_x=5000;
FLOOR.scale_y=5000;
FLOOR.scale_z=30;
FLOOR.z = -5;
FLOOR.red = 0;
FLOOR.green =0;
FLOOR.blue =0;
FLOOR.ambient = 25;
FLOOR.z=-50;

ph_setgravity (vector(0, 0, -6086)); // set the gravity

while (1)
{
// CONTROLS
mouse_pos.x = mouse_cursor.x;
mouse_pos.y = mouse_cursor.y;
camera.pan -= mouse_force.x * 2;
camera.tilt += mouse_force.y * 2;
if (key_w) camera.y += 12 * time_step;
if (key_s) camera.y -= 12 * time_step;
if (key_a) camera.x += 12 * time_step;
if (key_d) camera.x -= 12 * time_step;
on_e = new_box;
wait(1);
}
}

==============================================================

At present all i want the program to do is to create a box upon pressing the E key, then apply physics to that box so it falls onto the rather boxy landscape. I have a thing for boxes you see!

All models used in this script are boxes, bascally!


I am a noob to this... Blitz3D is where i am best at!
Re: Cant alter object after loading it... [Re: CdeathJD] #226412
09/09/08 18:22
09/09/08 18:22
Joined: Nov 2007
Posts: 1,143
United Kingdom
DJBMASTER Offline
Serious User
DJBMASTER  Offline
Serious User

Joined: Nov 2007
Posts: 1,143
United Kingdom
ok...

1) string* model; should be > STRING* model;
2) Why are you trying to access things like my_box.x and my_box.tilt? You havent defined these properties in the struct, so you cannot access them.

Re: Cant alter object after loading it... [Re: DJBMASTER] #226418
09/09/08 18:46
09/09/08 18:46
Joined: Aug 2008
Posts: 55
United Kingdom
CdeathJD Offline OP
Junior Member
CdeathJD  Offline OP
Junior Member

Joined: Aug 2008
Posts: 55
United Kingdom
what im trying to do is orientate the newly created object.

i tried "my_box.model.x" but that made it say ".x is not a member of STRING"
i tried "box.x" but that resulted in the stupid "syntax error"

i am out of other ideas to try!



Last edited by CdeathJD; 09/09/08 19:00.

I am a noob to this... Blitz3D is where i am best at!
Re: Cant alter object after loading it... [Re: CdeathJD] #226440
09/09/08 19:32
09/09/08 19:32
Joined: Nov 2007
Posts: 1,143
United Kingdom
DJBMASTER Offline
Serious User
DJBMASTER  Offline
Serious User

Joined: Nov 2007
Posts: 1,143
United Kingdom
yes but it doesn't contain a definition for x, so you cannot use it. You are trying to move it like an entity, and entities are a type of struct that have x, y,z ,etc properties defined.

for what you are doing you wont need to build a new struct, just use an entity.


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