Gamestudio Links
Zorro Links
Newest Posts
Executing Trades on Next Bar Open
by vicknick. 06/13/24 08:51
Zorro Beta 2.61: PyTorch
by jcl. 06/10/24 14:42
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
AUM Magazine
Latest Screens
The Bible Game
A psychological thriller game
SHADOW (2014)
DEAD TASTE
Who's Online Now
4 registered members (ozgur, Ayumi, VHX, monarch), 1,161 guests, and 4 spiders.
Key: Admin, Global Mod, Mod
Newest Members
AemStones, LucasJoshua, Baklazhan, Hanky27, firatv
19059 Registered Users
Previous Thread
Next Thread
Print Thread
Rate Thread
A7 template #272002
06/16/09 03:53
06/16/09 03:53
Joined: Mar 2009
Posts: 276
Cebu City, Philippines
boyax Offline OP
Member
boyax  Offline OP
Member

Joined: Mar 2009
Posts: 276
Cebu City, Philippines
Hi,

I want to use the pre-defined code included A7 template specifically the sky.
How I could use the c:\GStudio7\templates\code\sky.c to my project??

I've already included it in my project code
Code:
#include <acknex.h>
#include <default.c>

#define PRAGMA_PATH "%EXE_DIR%\templates\code";


Any samples/tutorials how to use it?

Thanks

Last edited by boyax; 06/16/09 03:59.
Re: A7 template [Re: boyax] #272009
06/16/09 05:46
06/16/09 05:46
Joined: Mar 2009
Posts: 276
Cebu City, Philippines
boyax Offline OP
Member
boyax  Offline OP
Member

Joined: Mar 2009
Posts: 276
Cebu City, Philippines
Do i need to put a sky-cube and assign it to the pointed texture in sky.c???

Here's my test code:
Code:
#include <acknex.h>
#include <default.c>

#define PRAGMA_PATH "%EXE_DIR%\templates\code";
#define PRAGMA_PATH "%EXE_DIR%\templates\images";

#include "sky.c";

function main()
{
	video_mode = 8;
	level_load("SkyTest.wmb");
	wait(2);
}


output:


Sky.c (found in C:\Program Files\GStudio7\templates\code)
Code:
#include <acknex.h>
#ifndef sky_wdl
#define sky_wdl

// ---------------------------------------------------------------------
// STARTHEADER
//
// ver: 5.0
// engineReq: 6.4
// date: 061011
//
// title: Day/Night Animated Sky (00)
// class: ENVIR
// type: USER
// image: sky00.pcx
// help: Create 3 sky spheres (with animation) and 2 scene maps.
//
//
// prefix: sky00_
// idcode: 01A
//
// ENDHEADER
// ---------------------------------------------------------------------

// block: Template Includes
// nothing...

// ---------------------------------------------------------------------
// section: Sky Sphere 0 (night sky)
ENTITY* sky00_00_sky =
{
	flags2 = SKY|DOME|VISIBLE;

// entry: Sky image
// id: 1
	type = "sky_stars.pcx";
// entry: Speed X
// id: 2
// help: Animation speed in x
	speed_u = 1.5;
// entry: Speed Y
// id: 3
// help: animation speed in y
	speed_v = 0.0;

// entry: Scale X
// id: 4
// help: Scale in X dimention
	scale_x = 0.125;
// entry: Scale Y
// id: 5
// help: Scale in y dimention
	scale_y = 0.125;

// entry: Layer
// id: 6
	layer = 1;
}

// section: Sky Sphere 1 (day sky)
ENTITY* sky00_01_sky =
{
	flags2 = SKY|DOME|VISIBLE;//???|TRANSPARENT;
// entry: Sky image
// id: 7
	type = "sky_blue.pcx";
// entry: Speed X
// id: 8
// help: Animation speed in x
	speed_u = 1.5;
// entry: Speed Y
// id: 9
// help: Animation speed in y
	speed_v = 0.5;

// entry: Scale X
// id: 10
// help: Scale in X dimention
	scale_x = 1.0;
// entry: Scale Y
// id: 11
// help: Scale in Y dimention
	scale_y = 1.0;


	alpha = 100;

// entry: Layer
// id: 12
	layer = 2;
}

// section: Sky Sphere 2 (cloud layer)
ENTITY* sky00_02_sky =
{
	flags2 = SKY|DOME|VISIBLE;

// entry: sky image
// id: 13
	type = "sky_cloud.pcx";
// entry: Speed X
// id: 14
// help: Animation speed in x
	speed_u = 3.5;
// entry: Speed Y
// id: 15
// help: Animation speed in y
	speed_v = 4.0;

// entry: Scale X
// id: 16
// help: Scale in X dimention
	scale_x = 1.0;
// entry: Scale Y
// id: 17
// help: Scale in Y dimention
	scale_y = 1.0;

	flags = OVERLAY|VISIBLE;//???|TRANSPARENT;  // sky dome, black transparent, alpha

	alpha = 75;

// entry: Layer
// id: 18
	layer = 3;
}

// Section: Nighttime horizon
ENTITY* sky00_00_scene =
{
	flags2 = SKY|SCENE|VISIBLE;

// entry: Scenemap image
// id: 19
	type = "night_mount.pcx";

// entry: Scale X
// id: 20
// help: How much horizon is taken by one image (1 = full 360 degrees)
	scale_x = 0.125;

// entry: Pan
// id: 21
// help: Rotate along the horizon (pan)
	pan = 0;
// entry: Tilt
// id: 22
// help: Rotate vertically (tilt)
	tilt = -3; // moves it

// entry: Layer
// id: 23
	layer = 4; // display above sky entities with lower layers
}

// section: Daytime horizon
ENTITY* sky00_01_scene =
{
	flags2 = SKY|SCENE;
	flags = VISIBLE;//???|TRANSPARENT; // backdrop scene, alpha, visible

// entry: scenemap image
// id: 24
	type = "sky_mount.pcx";

// entry: Scale X
// id: 25
// help: How much horizon is taken by one image (1 = full 360 degrees)
	scale_x = 0.125;

// entry: Pan
// id: 26
// help: Rotate along the horizon (pan)
	pan = 0;
// entry: Tilt
// id: 27
// help: Rotate vertically (tilt)
	tilt = -3; // moves it


// entry: Layer
// id: 28
	layer = 5; // display above sky entities with lower layers

	alpha = 100;
}


// ---------------------------------------------------------------------
// Local Vars
var sky00_day_or_night = 1;	// 1 for day, 0 for night, otherwise trans

// ---------------------------------------------------------------------
// Functions

void Sky00_Load_startup()
{
	diag("\nWDL-Loaded:Sky00.wdl");
}


// desc: transition from daytime (sky01) to nighttime (sky00) in the time
//  given by duration.
void Sky00_Day_To_Night(var duration)
{
	var trans;

	// not day or transitioning
	if(sky00_day_or_night != 1) { return(-1); }

	// turn on night layers
	set(sky00_00_sky,VISIBLE);    // nighttime sky
	set(sky00_00_scene,VISIBLE);	// nighttime horizon

	if(duration > 0) // make sure duration is valid
	{
		sky00_day_or_night = 0.5;	// flag that we are transitioning

		trans = duration;

		// fade to night
		while(trans > 0)
		{
			sky00_01_sky.alpha = 100*(trans/duration);
			sky00_01_scene.alpha = sky00_01_sky.alpha;
			trans -= time_step;
			wait(1);
		}

  		sky00_day_or_night = 0; // flag that we are in night mode
	}

	// turn off day layers
	sky00_01_sky.alpha = 0;
	sky00_01_scene.alpha = 0;
	reset(sky00_01_sky,VISIBLE);
	reset(sky00_01_scene,VISIBLE);
}

// desc: transition from nighttime (sky00) to daytime (sky01) in the time
//  given by duration.
void Sky00_Night_To_Day(var duration)
{
	var trans;

	// not night or transitioning
	if(sky00_day_or_night != 0) { return(-1); }

	// turn on day layers
	set(sky00_01_sky,VISIBLE);    // nighttime sky
	set(sky00_01_scene,VISIBLE);	// nighttime horizon

	// catch invalid values
	if(duration > 0)
	{
		sky00_day_or_night = 0.5;	// flag that we are transitioning

		trans = 0;

		// fade to day
		while(trans < duration)
		{
			sky00_01_sky.alpha = 100*(trans/duration);
			sky00_01_scene.alpha = sky00_01_sky.alpha;
			trans += time_step;
			wait(1);
		}

  		sky00_day_or_night = 1; // flag that we are in day mode
	}

	sky00_01_sky.alpha = 100;
	sky00_01_scene.alpha = 100;
	// turn off night
	reset(sky00_00_sky,VISIBLE);
	reset(sky00_00_scene,VISIBLE);
}


// desc: Fade the cloud layer from its current alpha to a target alpha in
//  the time given by duration.
void Sky00_Fade_Clouds(var targetAlpha, var duration)
{
	var trans;
	var delta;
	var start;

	// catch invalid values
	if(targetAlpha < 0) 	{ targetAlpha = 0; }  	// min alpha
	if(targetAlpha > 100) 	{ targetAlpha = 100; }	// max alpha
	if(duration <= 0)                   // duration not valid
	{
		sky00_02_sky.alpha = targetAlpha;
		return;
	}


	trans = 0;
	start = sky00_02_sky.alpha;
	delta = targetAlpha - sky00_02_sky.alpha;  // change in alpha

	while(trans < duration)
	{
		sky00_02_sky.alpha = start + delta*(trans/duration);
		trans += time_step;
		wait(1);
	}
	sky00_02_sky.alpha = targetAlpha;
}

#endif


Hope someone could help/clarify.

Thanks

Re: A7 template [Re: boyax] #289490
09/13/09 14:55
09/13/09 14:55
Joined: Aug 2009
Posts: 46
Deggendorf, Bayern
Fisch Offline
Newbie
Fisch  Offline
Newbie

Joined: Aug 2009
Posts: 46
Deggendorf, Bayern
First you need a skycube like the one below. Then open File->Project Manager and add the template.
When done costumize it!

Sample Skycube click here


The Internet is full of answers, even to never asked questions! laugh

Moderated by  HeelX, rvL_eXile 

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