0 registered members (),
18,435
guests, and 5
spiders. |
Key:
Admin,
Global Mod,
Mod
|
|
|
Can't seem to get this work
#233590
10/29/08 15:33
10/29/08 15:33
|
Joined: Oct 2008
Posts: 67
Crypton
OP
Junior Member
|
OP
Junior Member
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: zwecklos]
#233602
10/29/08 16:28
10/29/08 16:28
|
Joined: Oct 2008
Posts: 67
Crypton
OP
Junior Member
|
OP
Junior Member
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
Member
|
Member
Joined: Sep 2005
Posts: 274
Switzerland - Zurich
|
check your positions  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
Crypton
OP
Junior Member
|
OP
Junior Member
Joined: Oct 2008
Posts: 67
|
doh, ofcourse. Kinda switched x and y.  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]
#233678
10/29/08 21:32
10/29/08 21:32
|
Joined: Oct 2008
Posts: 67
Crypton
OP
Junior Member
|
OP
Junior Member
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 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: ////////////////////////////////////////////////////////////////////
#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:
< 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
Member
|
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
Member
|
Member
Joined: Sep 2005
Posts: 274
Switzerland - Zurich
|
Whats the width and height of your health.png? try this 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
Crypton
OP
Junior Member
|
OP
Junior Member
Joined: Oct 2008
Posts: 67
|
Whats the width and height of your health.png?
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.
/-/
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
|
|
|
Moderated by mk_1, Perro, rayp, Realspawn, Rei_Ayanami, rvL_eXile, Spirit, Superku, Tobias, TSG_Torsten, VeT
|