1 registered members (AndrewAMD),
14,661
guests, and 5
spiders. |
Key:
Admin,
Global Mod,
Mod
|
|
|
Re: HELP NEEDED URGENTLY
[Re: Ottawa]
#322713
05/08/10 23:25
05/08/10 23:25
|
Joined: Apr 2010
Posts: 59 Lagos, Nigeria
gameaddict
OP
Junior Member
|
OP
Junior Member
Joined: Apr 2010
Posts: 59
Lagos, Nigeria
|
Still didn't work. Windows just says not responding and I have to close it via the task bar. Here's the sructure and code. Folder: ...........player.mdl ...........main.c ...........player.c ...........moving.wmb I added too hollow cubes, textured them added a camera and it was working before I began coding. here's the edited codes main.c:
#include <acknex.h>
#include <default.c>
#include "player.c";
function main()
{
video_aspect = 1.333; // enforce 4:3 mode if you do not want widescreen in effect
video_mode = 7; // start resolution 800 x 600
video_screen = 1; // start in fullscreen mode
video_depth = 32; // otherwise 32 bit mode
wait (1);
level_load("moving.wmb");
}
//////////////////////////////////////// Here's player.c:
//////////////////////////////////////////////////////////////////////
#define move_x skill22 // movement skills
#define move_y skill23
#define move_z skill24
#define force_x skill25
#define force_y skill26
#define force_z skill27
#define velocity_x skill28
#define velocity_y skill29
#define velocity_z skill30
#define animate skill31 ///animation skills
#define animate2 skill32
#define animblend skill33
#define currentframe skill34
#define blendframe skill35
#define z_offset skill50 //gravity and jumping skills
#define jumping_mode skill51
#define gravity skill52
#define movement_mode skill53 //4 various movements, mainly combat
#define moving skill54
#define hit_by_player skill55
#define entity_type skill56
VECTOR* temp;
function handle_movement() {
temp.x = -1000;
temp.y = 0;
if(key_w ==1) { temp.x = camera.pan; }
if(key_s ==1) { temp.x = camera.pan + 180; }
if(key_a ==1) { temp.x = camera.pan + 90; }
if(key_d ==1) { temp.x = camera.pan - 90; }
if(temp.x != 1000) { temp.y = 15 * time_step; }
my.move_x = fcos(temp.x, temp.y);
my.move_y = fsin(temp.x, temp.y);
c_move(my, nullvector, my.move_x, USE_AABB | IGNORE_PASSABLE | GLIDE);
}
function handle_camera() {
//place cam behind player
vec_set(camera.x, vector(my.x + fcos(my.pan, -200), my.y + fsin(my.pan, -200), my.z + 80));
vec_diff(temp.x, my.x, camera.x); //make cam look towards player
vec_to_angle(camera.pan, temp.x);
}
action player_action()
{
set(my, SHADOW);
while(1); {
handle_movement();
handle_camera();
wait(1);
}
}
I don't really know how to use the code tags.... dunno if I got it.
I know I can.
|
|
|
Re: HELP NEEDED URGENTLY
[Re: gameaddict]
#322714
05/08/10 23:29
05/08/10 23:29
|
Joined: Apr 2010
Posts: 59 Lagos, Nigeria
gameaddict
OP
Junior Member
|
OP
Junior Member
Joined: Apr 2010
Posts: 59
Lagos, Nigeria
|
found an error: if(temp.x != 1000) { temp.y = 15 * time_step; } supposed to be -1000. I've corrected it in my code but it doesn't help.
I know I can.
|
|
|
Re: HELP NEEDED URGENTLY
[Re: gameaddict]
#322715
05/08/10 23:30
05/08/10 23:30
|
Joined: Apr 2006
Posts: 737 Ottawa, Canada
Ottawa
User
|
User
Joined: Apr 2006
Posts: 737
Ottawa, Canada
|
Hi!
remove the ; after #include "player.c"
You got the code boxes all right. For the other coded boxes and...look in FAQ under What UBBCode can I use in my posts?
edit : change the name of the temp variable to tempmine or something like that. The temp could be used elsewhere in GS.
Last edited by Ottawa; 05/08/10 23:33. Reason: added info
Hope this helps! Ottawa  Ver 7.86.2 Pro and Lite-C
|
|
|
Re: HELP NEEDED URGENTLY
[Re: Ottawa]
#322716
05/08/10 23:37
05/08/10 23:37
|
Joined: Apr 2010
Posts: 59 Lagos, Nigeria
gameaddict
OP
Junior Member
|
OP
Junior Member
Joined: Apr 2010
Posts: 59
Lagos, Nigeria
|
Still same problem. It just shows black screen and hangs.
I know I can.
|
|
|
Re: HELP NEEDED URGENTLY
[Re: gameaddict]
#322718
05/08/10 23:41
05/08/10 23:41
|
Joined: Apr 2006
Posts: 737 Ottawa, Canada
Ottawa
User
|
User
Joined: Apr 2006
Posts: 737
Ottawa, Canada
|
Hi!
Now look at your main.
It's the most important function of your game. It does one thing ...it loads the level. Then it does nothing.
How will the other function start? You have to start the game with a call to functions.
Hope this helps! Ottawa  Ver 7.86.2 Pro and Lite-C
|
|
|
Re: HELP NEEDED URGENTLY
[Re: gameaddict]
#322720
05/08/10 23:51
05/08/10 23:51
|
Joined: Apr 2006
Posts: 737 Ottawa, Canada
Ottawa
User
|
User
Joined: Apr 2006
Posts: 737
Ottawa, Canada
|
Hi! Been looking at your code.
Your action to player_action()
Is it assigned to an entity in your world? It should start the game if it is.
Hope this helps! Ottawa  Ver 7.86.2 Pro and Lite-C
|
|
|
Re: HELP NEEDED URGENTLY
[Re: gameaddict]
#322722
05/08/10 23:53
05/08/10 23:53
|
Joined: Apr 2010
Posts: 59 Lagos, Nigeria
gameaddict
OP
Junior Member
|
OP
Junior Member
Joined: Apr 2010
Posts: 59
Lagos, Nigeria
|
It always sends crash message of whatever function I call. I've tried handle_movement and even player_action() but it keeps crashing. eg
#include <acknex.h>
#include <default.c>
#include "player.c"
function main()
{
video_aspect = 1.333; // enforce 4:3 mode if you do not want widescreen in effect
video_mode = 7; // start resolution 800 x 600
video_screen = 1; // start in fullscreen mode
video_depth = 32; // otherwise 32 bit mode
wait (1);
level_load("moving.wmb");
player_action();
}
I know I can.
|
|
|
Re: HELP NEEDED URGENTLY
[Re: gameaddict]
#322723
05/08/10 23:56
05/08/10 23:56
|
Joined: Apr 2006
Posts: 737 Ottawa, Canada
Ottawa
User
|
User
Joined: Apr 2006
Posts: 737
Ottawa, Canada
|
Hi!
No for player action in main. It's an action and action start right away with your main if they are assigned to an entity in your world.
I got in a message while you were working on the solution.
Hope this helps! Ottawa  Ver 7.86.2 Pro and Lite-C
|
|
|
|