can you help me ? -> ent_create[i] for my MEGA SPACE GAME

Posted By: ratz

can you help me ? -> ent_create[i] for my MEGA SPACE GAME - 12/12/20 00:41

Hello everybody laugh

I want to create a "Space Ship ingame Editor" with 6 Moduls, where ou click it together from Panels shocked...

All Spaceship_Moduls are MapEntitys ! ( grin okey.. its an test cause i can't modeling )

i have find out, that you can load it in your level with
Code
ent_create("modul_a.wmb", vector(0,0,0) ,NULL;  

it works great and fast...

but now i have an problem:

how can i "say", witch kind of modules makes the ship ? ... with pointer like this ?

Code
//////////Editor Panel////////////////////

/*

function select_modul_a();
function select_modul_b();
function select_modul_c();
function select_modul_d();
function select_modul_e();
function select_modul_f();

int i;

var modul_var_1[i] = 0;
var modul_var_2[i] = 0;

var modul_x[i];
var modul_y[i];
var modul_z[i];

// panel 
// 
// 


function select_modul_a()
{
  modul_var_2[i] = 1;	
}

function select_modul_b()
{
  modul_var_2[i] = 2;	
}

function select_modul_c()
{
  modul_var_2[i] = 3;	
}

function select_modul_d()
{
  modul_var_2[i] = 4;	
}

function select_modul_e()
{
  modul_var_2[i] = 5;	
}

function select_modul_f()
{
  modul_var_2[i] = 6;	
}


function select_()
 {
  modul_var_1[i] = 1;	
 }
 

function save_craftet_moduls_to_ships_()
 {
  i++;
  ...	
 }


//------------------------------------


function create_modul[i]()
{
 
 if(modul_var_1[i] == 1 && modul_var_2[i] == 1) 
 {
  ent_create("modul_a.wmb",vector(modul_x[i], modul_y[i], modul_z[i]), NULL);
 } 


 if(modul_var_1[i] == 1 && modul_var_2[i] == 2) 
 {
  ent_create("modul_b.wmb",vector(modul_x[i], modul_y[i], modul_z[i]), NULL); 
 } 


 if(modul_var_1[i] == 1 && modul_var_2[i] == 3) 
 {
  ent_create("modul_c.wmb",vector(modul_x[i], modul_y[i], modul_z[i]), NULL);
 } 

 if(modul_var_1[i] == 1 && modul_var_2[i] == 4) 
 {
  ent_create("modul_d.wmb",vector(modul_x[i], modul_y[i], modul_z[i]), NULL); 
 } 

 if(modul_var_1[i] == 1 && modul_var_2[i] == 5) 
 {
  ent_create("modul_e.wmb",vector(modul_x[i], modul_y[i], modul_z[i]), NULL);
 } 

 if(modul_var_1[i] == 1 && modul_var_2[i] == 6) 
 {
  ent_create("modul_f.wmb",vector(modul_x[i], modul_y[i], modul_z[i]), NULL); 
 }
  modul_var_1[i] = 0;
 }

}

function create_ship[i]
{
 "->all clicket moduls + pos...     ->   | or add_shape ?
}



i++ counts up, because i need it for all ships

i hope you know what i mean

and how did i make 2d pos in 3d world pos ?

i hope you can help me laugh
greating: Patrick


Posted By: 3run

Re: can you help me ? -> ent_create[i] - 12/12/20 10:36

Hey Patrick!

For 'saying' if I got you correctl, you can use a list of ENTITYs. Something like this (psesudo-code):
Code
// max amount of ship modules
#define MODULE_MAX 6

// rename those with your ship parts
#define MODULE_ONE 0
#define MODULE_TWO 1
#define MODULE_THREE 2
#define MODULE_FOUR 3
#define MODULE_FIVE 4
#define MODULE_SIX 5

ENTITY *ship_module[MODULE_MAX]; // max 6 modules

void create_ship_modules()
{
	ship_module[MODULE_ONE] = ent_create("modul_a.wmb", pos, NULL);
	ship_module[MODULE_TWO] = ent_create("modul_b.wmb", pos, NULL);
	ship_module[MODULE_THREE] = ent_create("modul_c.wmb", pos, NULL);
	ship_module[MODULE_FOUR] = ent_create("modul_d.wmb", pos, NULL);
	ship_module[MODULE_FIVE] = ent_create("modul_e.wmb", pos, NULL);
	ship_module[MODULE_SIX] = ent_create("modul_f.wmb", pos, NULL);
}
You can manage "MapEntitys " names and position vectors the same way with arrays.

As for 2d pos in 3d pos. As far as I know, there is no real 2d engine, only 3d. So you'll have to set one axis at fixed number for all entities.
F.e. entity can move X (left-right) and Z (up-down) but it's Y position will always stay at 0 (make sure to set this after each c_move call).

Best regards.
Posted By: Dooley

Re: can you help me ? -> ent_create[i] - 12/12/20 17:51

You can set a camera view to ISOMETRIC and that might make it look more 2D. It's still a 3D game, but the look would be flat.
Posted By: ratz

Re: can you help me ? -> ent_create[i] - 12/14/20 23:07

Thank you very mutch

here is a small leak: ... OKEY THIS IS VERRY COOL :
________________________

i want create an 3d Space Game like "EVE" or "HOMEWORLD" where you can travel, build and create Spaceships + management Resorces,Buy an Sell and more...
but all what you see and create, must be works with my Engine* + GUI in 2D and 3D
-> so you can go inside the Spaceship, move and more crazy crazy crazy crazy



My Idea:

-> What does it happen, if you make the same,...but all with an chunk in 1x1x1 Voxel (3D pixel) AND every pixel/Voxel will works like an Atom ???? cool cool cool
-> so you need the Peeriod-System of Elements and many many other Ediors for Materials / and other sfuff! laugh

[Linked Image]

->you can see the Ship Modules laugh
-> later you can build your own modules with materials where you creating with Elements :-O blush tongue



* i need an online databank only for ALL*ALL Elements + CollisionsSystem + own datafiles to save, load and create Materials that you makes with elements and even even even more cry grin
(work in process, t !!!


THIS GAME WILL BE VERRY BIG !

___________________________

GUI TEST VIDEO

[video:youtube]https://www.youtube.com/watch?v=xlggVmMmkfQ[/video]



wasn't there in the past an function, where you can show in View from panls the 3d GameStuio WED (front,top,up ) window ? Aum ?
Posted By: Dooley

Re: can you help me ? -> ent_create[i] - 12/15/20 13:55

I would suggest starting smaller, get things working with only five elements first. Then once that is working, you can expand to more.

You can use a VIEW and project it onto a bitmap. Look at "bmap_for_entity" in the manual...
Posted By: ratz

Re: can you help me ? -> ent_create[i] for my MEGA SPACE GAME - 12/15/20 22:37

update grin

[Linked Image]
1/2 year work for all buttons, create in PhotoFilter free


-> last question: how can i made it, that i can scale the main window "DEMO" with the mouse ?

Posted By: Dooley

Re: can you help me ? -> ent_create[i] for my MEGA SPACE GAME - 12/16/20 04:57

video_window(NULL,NULL,4,NULL);
Posted By: ratz

Re: can you help me ? -> ent_create[i] for my MEGA SPACE GAME - 12/19/20 14:54

did the define method works with strings, too ?
like this

Code
 

STRING* string1_name = "bla";
STRING* string1_id = "bla bla";
STRING* string1_typ = "bla bla bla";

PANEL* pan_info =
{
   
    digits(710,150,0,*,0,string1_name);
    digits(710,160,0,*,0,string1_id);
    digits(710,170,0,*,0,string1_typ);
     
    layer = 6;
}



with/in this ?

Code

#define STRING_NAME_MAX 6
#define STRING_ID_MAX 6
#define STRING_TYP_MAX 6

#define STRING_NAME_ONE 0
#define STRING_NAME__TWO 1
#define STRING_NAME__THREE 2
#define STRING_NAME__FOUR 3
#define STRING_NAME__FIVE 4
#define STRING_NAME__SIX 5

#define STRING_ID_ONE 0
#define STRING_ID__TWO 1
#define STRING_ID__THREE 2
#define STRING_ID__FOUR 3
#define STRING_ID__FIVE 4
#define STRING_ID__SIX 5

#define STRING_TYP_ONE 0
#define STRING_TYP__TWO 1
#define STRING_TYP__THREE 2
#define STRING_TYP__FOUR 3
#define STRING_TYP__FIVE 4
#define STRING_TYP__SIX 5

STRING *string_name[STRING_NAME_MAX]; 
STRING *string_id[STRING_ID_MAX];
STRING *string_typ[STRING_TYP_MAX]; 


PANEL* pan_info =
{
   
    digits(710,150,0,*,0,string_name[STRING_NAME_MAX]);
 //   digits(710,160,0,*,0,string1_id);
 //   digits(710,170,0,*,0,string1_typ);
     
    layer = 6;
}



Compiler says too many arguments in Digits]
Posted By: 3run

Re: can you help me ? -> ent_create[i] for my MEGA SPACE GAME - 12/19/20 19:20

Well, first of all, you need to initialize those strings, each one with 'str_create'. Also, for displaying text (strings) use TEXT instead of PANEL, without digits (this are for numbers primary).
Aside from that I'm not sure if digits can accept an array... If not then a simpler solution will be copying the content of the needed array, directly into the digits variable.

Code
STRING *list_of_str[10];

TEXT *my_text =
{
	font = "Arial#24bi";
	flags = SHOW;
}

void main()
{
	list_of_str[0] = str_create("#256");
	str_cpy(list_of_str[0], "first_str_goes_here");
	
	// copy content from the array into the text
	str_cpy((my_text.pstring)[0], list_of_str[0]); 
}


Greets!
Posted By: ratz

Re: can you help me ? -> ent_create[i] for my MEGA SPACE GAME - 12/19/20 22:28

Code
str_cpy ! That was it ! 
and thanks for all other helping people, Danke euch, echt !
yes i have see the pstring line in manual, but there wasn't a runtime example
sry i use digits, because ->
Code
set(text_txt,  SHOW); 
doesn't work, i don't know why
and i wonedering that it works in digits , because the lite C Manual says
Code
digits(x,y,font, "text",*,var)

... and vars are numbers
© 2024 lite-C Forums