Gamestudio Links
Zorro Links
Newest Posts
New FXCM FIX Plugin
by flink. 06/04/24 07:30
AlpacaZorroPlugin v1.3.0 Released
by kzhao. 05/22/24 13:41
Free Live Data for Zorro with Paper Trading?
by AbrahamR. 05/18/24 13:28
Change chart colours
by 7th_zorro. 05/11/24 09:25
AUM Magazine
Latest Screens
The Bible Game
A psychological thriller game
SHADOW (2014)
DEAD TASTE
Who's Online Now
1 registered members (AndrewAMD), 1,225 guests, and 8 spiders.
Key: Admin, Global Mod, Mod
Newest Members
AemStones, LucasJoshua, Baklazhan, Hanky27, firatv
19056 Registered Users
Previous Thread
Next Thread
Print Thread
Rate Thread
Help with unit placement #241793
12/18/08 21:55
12/18/08 21:55
Joined: Nov 2005
Posts: 1,007
jigalypuff Offline OP
Serious User
jigalypuff  Offline OP
Serious User

Joined: Nov 2005
Posts: 1,007
Hi i have been banging my head against this all night and just can`t figure a way to do it frown
I have a function which creates a grid, another which allows a player to select some ships so he can make a fleet, when a ship is selected from the image menu i use ent_create to get a model which i then want the player to place on the grid, so i kinda need a function which will actually create the ship only when the player clicks on the grid? could someone please help me out smile

here is the code which makes the grid
Code:
function tile_position
{
	my.tilt = 90;
	my.oriented =on;
	my.transparent = on;
	while(1)
	{
		my.alpha = 80+20*sin(my.x+my.y+total_ticks*15);
		wait(1);
	}
}

function create_table
{
	
	var i;
	while(i<table_width*table_width)
	{
		you = ent_create(tile_map,nullvector,tile_position);
		your.x = (i%table_width)*tile_size-(table_width*tile_size)/2;
		your.y = int(i/table_width)*tile_size-(table_width*tile_size)/2;
		i+=1;
	}
}


and this is the panel and current make ship code

Code:

function ship_selected()
{
	if(bmapno == 1)
	{
	galor_class();
	}
	if(bmapno == 2)
	{
		keldon_class();
	}
}

function ship_function()
{
my.enable_click = on;
if(mouse_left == 1)
{
	ship_pan.visible = on;
}
}

function galor_class
{
	ent_create(cgc_a, nullvector, ship_function);
}

i click on a button to get the ent_create to work, also for some reason my.enable_click does not seem to work frown


Why does everyone like dolphins? Never trust a species which smiles all the time!
Re: Help with unit placement [Re: jigalypuff] #241799
12/18/08 22:41
12/18/08 22:41
Joined: Oct 2004
Posts: 1,655
T
testDummy Offline
Serious User
testDummy  Offline
Serious User
T

Joined: Oct 2004
Posts: 1,655
theory / sample only
Code:
STRING ship_s1[256]; // set from ship selection menu?
function tile_event() {
	if (EVENT_TYPE == EVENT_CLICK) {
		//...?
		wait(1);
		//ent_create(ship_s1, v?, f?);  // create / place ship at my.x?
	}
}
function tile_position() {
	my.enable_click = on;
	my.event = tile_event;
	//MOUSE_RANGE = ?; // default = 1000
	my.tilt = 90;
	my.orientated  = on;
	my.transparent = on;
	while(1) {
		my.alpha = 80+20*sin(my.x+my.y+total_ticks*15);
		wait(1);
	}
}



Re: Help with unit placement [Re: testDummy] #241897
12/19/08 20:42
12/19/08 20:42
Joined: Nov 2005
Posts: 1,007
jigalypuff Offline OP
Serious User
jigalypuff  Offline OP
Serious User

Joined: Nov 2005
Posts: 1,007
i have gotten this sorta working smile were you have v? i put my.x not to sure what the f? was i guessed function smile i set that to this simple one
Code:
function ship_function()
{
my.enable_click = on;
if(mouse_left == 1)
{
	ship_pan.visible = on;
}

}

So far i can get one ship to appear were i click so so far so good, i now shall try to add more ships, thanks for your help it is much appreciated.


Why does everyone like dolphins? Never trust a species which smiles all the time!

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