|
Learning gamestudio A7
#365610
03/27/11 20:15
03/27/11 20:15
|
Joined: Mar 2010
Posts: 56 Hertfordshire, England
Panda_Dude
OP
Junior Member
|
OP
Junior Member
Joined: Mar 2010
Posts: 56
Hertfordshire, England
|
This is about A7, so I thought I'd post it here. I have some script and I don't know what's wrong. I have checked with the tutorial and I don't think I've missed anything. Would someone mind going through my script? I'm sure it's probably something simple.
#include <acknex.h>
#include <default.c>
var health = 200;
BMAP* panel = "panel.bmp";
BMAP* healthbar = "window.bmp";
BMAP* knob = "slider.bmp";
STRING* s_health = "Health";
ENTITY* car1 = "car1.mdl";
TEXT* t_health =
{
pos_x = 44;
pos_y = 22;
layer = 10;
string (s_health);
FLAGS = SHOW;
}
function main ()
{
level_load("room.wmb");
vec_set(camera.x, vector(16,447,358));
vec_set(camera.pan,vector(90,-89,0));
screen_size.x = 500;
screen_size.y = 500;
screen_color.green = 150;
mouse_mode = 4;
}
PANEL* first_panel =
{
BMAP = panel;
window(40,10,50,3,healthbar,health,NULL);
digits(7,12,3,"Arial#15",1,health);
vslider(7,52,31,knob,200,0,health);
FLAGS = OVERLAY | SHOW | OUTLINE;
}
action* car =
{
car1 = me;
while (1)
{
if (key_a)
my.pan -= 3 * time_step;
if (key_d)
my.pan += 3 * time_step;
if (key_w)
c_move(car1,vector(5 * time_step,0,0),nullvector,GLIDE);
if (key_s)
c_move(car1,vector(5 * time_step,0,0),nullvector,GLIDE);
}
}
The script won't even start running. I don't know what's wrong exactly, but I'm pretty sure it's to do with the car 1 action. Thanks for any help!
Last edited by Panda_Dude; 03/27/11 20:16.
|
|
|
Re: Learning gamestudio A7
[Re: Panda_Dude]
#365615
03/27/11 20:32
03/27/11 20:32
|
Joined: Mar 2006
Posts: 3,538 WA, Australia
JibbSmart
Expert
|
Expert
Joined: Mar 2006
Posts: 3,538
WA, Australia
|
No worries  There should be a "wait(1);" in the while loop so it gets to the next frame. Jibb
Formerly known as JulzMighty. I made KarBOOM!
|
|
|
Re: Learning gamestudio A7
[Re: JibbSmart]
#365616
03/27/11 20:34
03/27/11 20:34
|
Joined: Mar 2010
Posts: 56 Hertfordshire, England
Panda_Dude
OP
Junior Member
|
OP
Junior Member
Joined: Mar 2010
Posts: 56
Hertfordshire, England
|
so like this?
action car()
{
car1 = me;
while (1)
{
if (key_a)
my.pan -= 3 * time_step;
if (key_d)
my.pan += 3 * time_step;
if (key_w)
c_move(car1,vector(5 * time_step,0,0),nullvector,GLIDE);
if (key_s)
c_move(car1,vector(5 * time_step,0,0),nullvector,GLIDE);
}
wait (1);
}
It still doesn't move the car. Or do I do the wait (1) inside the parenthesis for the while? I tried both and it doesn't move the car.
Last edited by Panda_Dude; 03/27/11 20:37.
|
|
|
Re: Learning gamestudio A7
[Re: Panda_Dude]
#365617
03/27/11 20:43
03/27/11 20:43
|
Joined: Mar 2006
Posts: 3,538 WA, Australia
JibbSmart
Expert
|
Expert
Joined: Mar 2006
Posts: 3,538
WA, Australia
|
Inside the braces.
What happens is: the while loop happens infinitely, without giving other functions/rendering/everything else a chance to happen, so "wait (1);" tells the engine to wait until the next frame before continuing.
Lastly (I think), I just realised, you're using a view entity, which I believe can't use c_move and the like. Use ent_create instead to put your entity in the level.
Jibb
Formerly known as JulzMighty. I made KarBOOM!
|
|
|
Re: Learning gamestudio A7
[Re: JibbSmart]
#365618
03/27/11 20:45
03/27/11 20:45
|
Joined: Mar 2010
Posts: 56 Hertfordshire, England
Panda_Dude
OP
Junior Member
|
OP
Junior Member
Joined: Mar 2010
Posts: 56
Hertfordshire, England
|
ok I'll try that then. What is a view entity? and also, do I still have to define the entity and attach the action to it? can I change the action to a function and put that in the ent_create parameters?
Last edited by Panda_Dude; 03/27/11 20:53.
|
|
|
Re: Learning gamestudio A7
[Re: Panda_Dude]
#365620
03/27/11 20:57
03/27/11 20:57
|
Joined: Mar 2006
Posts: 3,538 WA, Australia
JibbSmart
Expert
|
Expert
Joined: Mar 2006
Posts: 3,538
WA, Australia
|
Actually, I just got confused about the view entity thing. Is your car placed manually in WED? Make sure it has been given the "car" action.
Jibb
Formerly known as JulzMighty. I made KarBOOM!
|
|
|
Re: Learning gamestudio A7
[Re: JibbSmart]
#365621
03/27/11 21:01
03/27/11 21:01
|
Joined: Mar 2010
Posts: 56 Hertfordshire, England
Panda_Dude
OP
Junior Member
|
OP
Junior Member
Joined: Mar 2010
Posts: 56
Hertfordshire, England
|
Well I know where the problem lies there... I can't seem to get the list of actions populated. There are no actions to select. I have selected the script from the map properties section but the action I created isn't available. EDIT: ok, I selected the action from the list for the car, but the car still won't move.
Last edited by Panda_Dude; 03/27/11 21:05.
|
|
|
|