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,633 guests, and 5 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
Page 1 of 2 1 2
Can't seem to get this work #233590
10/29/08 15:33
10/29/08 15:33
Joined: Oct 2008
Posts: 67
C
Crypton Offline OP
Junior Member
Crypton  Offline OP
Junior Member
C

Joined: Oct 2008
Posts: 67
I have followed some tutorials for SED.
I wanted to recreate a pice of code myself to see how well I have learned from it. But it seems that it doesn't work.
---------------------
Previous solved, new one:

See the post



New into Gamestudio and eager to learn it..
Stuff and games done in 2D: LINK
Re: Can't seem to get this work [Re: Crypton] #233596
10/29/08 16:14
10/29/08 16:14
Joined: Sep 2005
Posts: 274
Switzerland - Zurich
zwecklos Offline
Member
zwecklos  Offline
Member

Joined: Sep 2005
Posts: 274
Switzerland - Zurich
Hi there,
You are using c-lite syntax in a wdl file.
save your scripts with a .c extension, then this should work for you.

cheers

Re: Can't seem to get this work [Re: zwecklos] #233602
10/29/08 16:28
10/29/08 16:28
Joined: Oct 2008
Posts: 67
C
Crypton Offline OP
Junior Member
Crypton  Offline OP
Junior Member
C

Joined: Oct 2008
Posts: 67
well it seems that I got the thing running, but I can't see any image though :S.
Tried any image file basically, still nothing..


New into Gamestudio and eager to learn it..
Stuff and games done in 2D: LINK
Re: Can't seem to get this work [Re: Crypton] #233615
10/29/08 16:50
10/29/08 16:50
Joined: Sep 2005
Posts: 274
Switzerland - Zurich
zwecklos Offline
Member
zwecklos  Offline
Member

Joined: Sep 2005
Posts: 274
Switzerland - Zurich
check your positions cool

you define the y position of your panel on 755 while you are using 800x600.

so your panel is out of the screen.

cheerio


Last edited by zwecklos; 10/29/08 16:53.
Re: Can't seem to get this work [Re: zwecklos] #233618
10/29/08 16:54
10/29/08 16:54
Joined: Oct 2008
Posts: 67
C
Crypton Offline OP
Junior Member
Crypton  Offline OP
Junior Member
C

Joined: Oct 2008
Posts: 67
doh, ofcourse. Kinda switched x and y. laugh
Thanks again!


New into Gamestudio and eager to learn it..
Stuff and games done in 2D: LINK
Re: Can't seem to get this work [Re: Crypton] #233624
10/29/08 17:12
10/29/08 17:12
Joined: Sep 2005
Posts: 274
Switzerland - Zurich
zwecklos Offline
Member
zwecklos  Offline
Member

Joined: Sep 2005
Posts: 274
Switzerland - Zurich
you are welcome.

have fun while playing around with the engine cool

Re: Can't seem to get this work [Re: Crypton] #233678
10/29/08 21:32
10/29/08 21:32
Joined: Oct 2008
Posts: 67
C
Crypton Offline OP
Junior Member
Crypton  Offline OP
Junior Member
C

Joined: Oct 2008
Posts: 67
I will and having a new impro from an example:
Okei I hope nobody gets angry if I put new question in here instead making a new short topic smile

The basic idea is that I want to make a healtbar that is cut shorter when health decreases. Leaving the background transparent. Achieving it in a way that I shorten the window width. (Possible method?)

I got so far with my tutorials that I covered "panels".
So here is my code which ofcourse doesn't work:

Code:
////////////////////////////////////////////////////////////////////
#include <acknex.h>
#include <default.c>
///////////////////////////////////////////////////////////////////

var health = 100;
var win_width = (85*health)/100; //Calculate the number of pixels which corresponds to health filling
var win_height = 15;

//The whole panel
PANEL* lives_pnl =
{
	bmap = "panel.png"; //background for bars
	pos_x = 2;
	pos_y = 2;
        //Trying to draw healthbar with corresponding values I set earlier
	window(22,4,win_width,win_height,"health.png",0,0);
	flags = VISIBLE;
}

function main()
{
	video_mode = 6;
	//win_width = (85*health)/100;
}


Error:
Code:

< window(22,4^win_width,win_height,"health.png",0,0);>
LIFEBAR_TEST.C 5:6  (): Number syntax win_width   



There seems to be some syntax thing in variable which I declared so here's the question: I can't use variables in those definitions then ?? I think right now, maybe(well actually for sure) it creates a demical number which I don't know how to define yet?


New into Gamestudio and eager to learn it..
Stuff and games done in 2D: LINK
Re: Can't seem to get this work [Re: Crypton] #233715
10/30/08 01:33
10/30/08 01:33
Joined: Sep 2005
Posts: 274
Switzerland - Zurich
zwecklos Offline
Member
zwecklos  Offline
Member

Joined: Sep 2005
Posts: 274
Switzerland - Zurich
Hi there,
For a healthbar I would use:

hslider (x, y, len, bmap, min, max, var);

or if you going for a vertical bar:

vslider (x, y, len, bmap, min, max, var);

You can find more informations/examples in the manual.

cheers

EDIT: Nah sorry, window is the better way to go. sliders are more for actuators.

Last edited by zwecklos; 10/30/08 01:38.
Re: Can't seem to get this work [Re: zwecklos] #233721
10/30/08 01:51
10/30/08 01:51
Joined: Sep 2005
Posts: 274
Switzerland - Zurich
zwecklos Offline
Member
zwecklos  Offline
Member

Joined: Sep 2005
Posts: 274
Switzerland - Zurich
Whats the width and height of your health.png?

try this code:

Code:
window(22,4,png_width_in_pixels,png_height_in_pixels,"health.png",health,0);


this is for a horizontaly bar.
If you decrease now the health variable, the bar should become shorter.

Last edited by zwecklos; 10/30/08 01:57.
Re: Can't seem to get this work [Re: zwecklos] #233743
10/30/08 09:54
10/30/08 09:54
Joined: Oct 2008
Posts: 67
C
Crypton Offline OP
Junior Member
Crypton  Offline OP
Junior Member
C

Joined: Oct 2008
Posts: 67
Originally Posted By: zwecklos
Whats the width and height of your health.png?

Code:
window(22,4,png_width_in_pixels,png_height_in_pixels,"health.png",health,0);


this is for a horizontaly bar.
If you decrease now the health variable, the bar should become shorter.


Only that in your code I don't have a bitmap that is being moved inside window. I kinda need to cut it instead. Unfortunately your code won't do the trick.
Code:
/-/
float win_width = (85*health)/100; //Calculate the number of pixels which corresponds to health value
var win_height = 15;
/-/ 
//Inside panel is this:
window(22,4,win_width,win_height,"health.png",0,0);
/-/

These are the numbers for bmap's width and height (Changed win_width to float too now). I calculate width according to health's fill number. Basically when I have 100 health my picture (or window in that case) is 85 pixels, if I have 50 health picture will be then 42,5 pixels. But I guess here's the catch!
The window() doesn't accept demical numbers in it (I have tested). Even if I replace the demical value with a real value and keep the win_height in, I still get an error but this time for win_height. It won't accept variables in it too or I have defined somehow wrong?

When I change manually these values (without variables and in real values) it's fine - working.
It's interesting to know what I'm doing wrong here :P.


New into Gamestudio and eager to learn it..
Stuff and games done in 2D: LINK
Page 1 of 2 1 2

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