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,618 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 4 of 5 1 2 3 4 5
Re: HELP NEEDED URGENTLY [Re: gameaddict] #322751
05/09/10 09:21
05/09/10 09:21
Joined: Sep 2009
Posts: 1,032
Budapest
Aku_Aku Offline
Serious User
Aku_Aku  Offline
Serious User

Joined: Sep 2009
Posts: 1,032
Budapest
There are some conversions of KHmovement from wdl to lite-c.
For example: KHmovement
See the fourth entry from the top, from testDummy member.

Re: HELP NEEDED URGENTLY [Re: Aku_Aku] #322754
05/09/10 09:39
05/09/10 09:39
Joined: Apr 2010
Posts: 59
Lagos, Nigeria
gameaddict Offline OP
Junior Member
gameaddict  Offline OP
Junior Member

Joined: Apr 2010
Posts: 59
Lagos, Nigeria
thanks, I'll go check it.


I know I can.
Re: HELP NEEDED URGENTLY [Re: gameaddict] #322755
05/09/10 09:49
05/09/10 09:49
Joined: Sep 2009
Posts: 1,032
Budapest
Aku_Aku Offline
Serious User
Aku_Aku  Offline
Serious User

Joined: Sep 2009
Posts: 1,032
Budapest
I advise, study the whole thread from the beginning to the last post. Maybe there are other tips, corrections.

Re: HELP NEEDED URGENTLY [Re: gameaddict] #322756
05/09/10 09:55
05/09/10 09:55
Joined: Apr 2010
Posts: 59
Lagos, Nigeria
gameaddict Offline OP
Junior Member
gameaddict  Offline OP
Junior Member

Joined: Apr 2010
Posts: 59
Lagos, Nigeria
Thanks it works. Don't really understand it much. I'll try comparing it with the original tutorial to see if I can still learn it. Thanks.


I know I can.
Re: HELP NEEDED URGENTLY [Re: gameaddict] #322777
05/09/10 13:49
05/09/10 13:49
Joined: Apr 2010
Posts: 59
Lagos, Nigeria
gameaddict Offline OP
Junior Member
gameaddict  Offline OP
Junior Member

Joined: Apr 2010
Posts: 59
Lagos, Nigeria
Hi guys! new problem tired

I'm currently using the lite-c version to learn the code. I'm following both tutorials and I've gotten the player to move without animation. Problem is, after coding the animation.c and editing the player.c as required, The program won't run. In WED, it says error in MAIN line 13. There's nothing on line 13 and I've corrected all syntax errors I could find. Please help me. I'm posting all my code here:

main.c:

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

#include "player.c"
#include "animation.c"

function main()
{
	camera.clip_near = 0;
	video_switch(7,0,1);
	level_load("m2.wmb");
}



player.c:

Code:
//////////////////////////////////////////////////////////////////////
function handle_movement();
function handle_camera();
function handle_animation(var animation_speed);

#define nullframe -2
#define blend     -1
#define stand      0
#define run        1
#define  walk      2
#define  jump      3
#define  fall      4
#define attack_a   5
#define attack_b   6
#define attack_c   7
#define attack_d   8
#define attack_e   9
#define attack_f   10


#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*	tempV = { x=0; y=0; z=0;}
VECTOR*	tempV2= { x=0; y=0; z=0; }

ANGLE*	tempA = { pan=0; tilt=0; roll=0; }
ANGLE*	tempA2= { pan=0; tilt=0; roll=0; }

VECTOR*	camera_move_to = { x=0;	y=0;	z=0; }

var temp;
var camera_distance = 200;
var camera_pan;
var camera_tilt;



action player_action()
{
	set(my, SHADOW);
	while(1) {
		handle_movement();
		handle_camera();
		handle_animation(1);
		wait(1);
	}
}

function handle_movement()
{
	tempV.x = -1000;
	tempV.y = 0;
   if(key_w == 1 && key_s == 0 && key_a == 0 && key_d == 0) {tempV.x = camera.pan;}
   if(key_s == 1 && key_w == 0 && key_a == 0 && key_d == 0)	{tempV.x = camera.pan + 180;}
   if(key_a == 1 && key_s == 0 && key_w == 0 && key_d == 0)	{tempV.x = camera.pan + 90;}
   if(key_d == 1 && key_s == 0 && key_a == 0 && key_w == 0)	{tempV.x = camera.pan - 90;}
   if(key_w == 1 && key_a == 1 && key_d == 0 && key_s == 0)	{tempV.x = camera.pan + 45; }
   if(key_w == 1 && key_d == 1 && key_a == 0 && key_s == 0)	{tempV.x = camera.pan - 45; }
	if(key_s == 1 && key_a == 1 && key_d == 0 && key_w == 0)	{tempV.x = camera.pan + 135;}
	if(key_s == 1 && key_d == 1 && key_a == 0 && key_w == 0)	{tempV.x = camera.pan - 135; }
   if(tempV.x != -1000) {tempV.y = 15 * time_step;}
   my.move_x = fcos(tempV.x, tempV.y);
   my.move_y = fsin(tempV.x, tempV.y);
   c_move(my, nullvector, my.move_x, USE_BOX | IGNORE_PASSABLE | GLIDE);
   
   if(my.move_x != 0 || my.move_y != 0) { // if we are moving
   	  if(my.animblend == stand) { 
   	      // if current animation is stand
   	      if(key_shift == 1) { my.blendframe = walk; } 
   	      else {my.blendframe = run; }
        }
        
        if(my.animblend == run && key_shift == 1) { my.blendframe = walk; }
        if(my.animblend == walk && key_shift == 0) { my.blendframe = run; }
   } else {
   	      if(my.animblend > stand) { 
   	      //if we aren't moving and our current animation 
   	      //is walk or run, blend and cycle the stand animation
   	      my.blendframe = stand; 
            }
          }


function handle_camera() 
{
	camera.pan -=  mouse_force.x * 12 * time_step;
	camera.tilt += mouse_force.y * 8 * time_step;
	camera.tilt = clamp(camera.tilt, -30, 10);
	temp = fcos(camera.tilt, -camera_distance);
	vec_set(camera.x, vector(my.x + fcos(camera.pan, temp),my.y + fsin(camera.pan, temp),my.z + 20 + fsin(camera.tilt, -camera_distance)));

	vec_diff(tempV.x, camera.x, my.x); //find the vector from the player to the camera
	vec_normalize(tempV.x, 16); //get the magnitude of it's vector to 16 quants and store it in temp
	vec_add(tempV.x, camera.x); //add the vector (from player to camera) of a magnitude of 16 quants and add it to the camera's position.

	result = c_trace(my.x, tempV.x, IGNORE_ME|IGNORE_PASSABLE|IGNORE_MODELS); //trace from the player to 16 quants behind the camera.
	if(result > 0) 
	{
		vec_diff(tempV.x, my.x, target.x); //find the vector from the point the trace hit to the player
		vec_normalize(tempV.x, 16); //get the magnitude of this vector to 16 quants and store in temp
		vec_set(camera.x, target.x); //place the camera at the trace hit point
		vec_add(camera.x, tempV.x); //move the camera away from the wall by the vector temp, 16 quants towards the player
	}
}



animation.c:

Code:
function handle_animation(var animation_speed)
{
   if(animation_speed <= 0) { animation_speed = 1;}
   if(my.animblend != blend && my.blendframe != nullframe) { 
      my.animate2 = 0; 
      my.animblend = blend;
   }
   
   if(my.animblend == blend) {
   	if(my.currentframe == stand) {ent_animate(my, "stand", my.animate, ANM_CYCLE); }
   	if(my.currentframe == run) { ent_animate(my, "run", my.animate, ANM_CYCLE); }
   	if(my.currentframe == walk) { ent_animate(my, "walk", my.animate, ANM_CYCLE); }
   	if(my.blendframe == stand) { ent_blend("stand", 0, my.animate2); }
   	if(my.blendframe == run) { ent_blend("run", 0, my.animate2); }
   	if(my.blendframe == walk) { ent_blend("walk", 0, my.animate2); }	
   	my.animate2 += 45 * time_step;
   	if(my.animate2 >= 100) {
   		my.animate = 0;
   		my.animblend = my.blendframe;
   		my.blendframe = nullframe;	
      }
   }
   
   if(my.animblend == stand) {
   	ent_animate(my, "stand", my.animate, ANM_CYCLE);
   	my.animate += 5 * animation_speed * time_step;
   	my.animate %= 100;
   	my.currentframe = stand;	
   }
   
   if(my.animblend == run) {
   	ent_animate(my, "run", my.animate, ANM_CYCLE);
   	my.animate += 6.8 * animation_speed * time_step;
   	my.animate %= 100;
   	my.currentframe = run;
   }
   
   if(my.animblend == walk) {
   	ent_animate(my, "walk", my.animate, ANM_CYCLE);
   	my.animate += 8 * animation_speed * time_step;
   	my.animate %= 100;
   	my.currentframe = walk;
   }
}




I know I can.
Re: HELP NEEDED URGENTLY [Re: gameaddict] #322779
05/09/10 13:56
05/09/10 13:56
Joined: Dec 2008
Posts: 1,218
Germany
Rackscha Offline
Serious User
Rackscha  Offline
Serious User

Joined: Dec 2008
Posts: 1,218
Germany
first thing you should avoid is to use a vector pointre at the beginning of player.c(VECTOR instead of VECTOR*).

I'll try your code later(currently no time sry)


Greets
Rackscha


MY Website with news of my projects:
(for example my current
Muliplayer Bomberman,
GenesisPrecompiler for LiteC
and TileMaster, an easy to use Tile editor)
Sparetime-Development

Re: HELP NEEDED URGENTLY [Re: Rackscha] #322780
05/09/10 13:59
05/09/10 13:59
Joined: Apr 2010
Posts: 59
Lagos, Nigeria
gameaddict Offline OP
Junior Member
gameaddict  Offline OP
Junior Member

Joined: Apr 2010
Posts: 59
Lagos, Nigeria
okay, thanks.


I know I can.
Re: HELP NEEDED URGENTLY [Re: gameaddict] #322781
05/09/10 14:14
05/09/10 14:14
Joined: Dec 2008
Posts: 1,218
Germany
Rackscha Offline
Serious User
Rackscha  Offline
Serious User

Joined: Dec 2008
Posts: 1,218
Germany
Oh an one question:

Did you convert the code call by call or did you convert it in one rush(and now haveing problems?)


Greets
Rackscha


MY Website with news of my projects:
(for example my current
Muliplayer Bomberman,
GenesisPrecompiler for LiteC
and TileMaster, an easy to use Tile editor)
Sparetime-Development

Re: HELP NEEDED URGENTLY [Re: Rackscha] #322783
05/09/10 14:35
05/09/10 14:35
Joined: Apr 2010
Posts: 59
Lagos, Nigeria
gameaddict Offline OP
Junior Member
gameaddict  Offline OP
Junior Member

Joined: Apr 2010
Posts: 59
Lagos, Nigeria
I'm converting it using reference from the already converted code. I'm trying to learn so I'm adding the code little by little. I test it at certain points and I've just gotten to the animation and blending part. The code is similar to the already converted but it's following the tutorial step by step. I haven't added parts like gravity and sword.


I know I can.
Re: HELP NEEDED URGENTLY [Re: gameaddict] #322795
05/09/10 16:31
05/09/10 16:31
Joined: Apr 2010
Posts: 59
Lagos, Nigeria
gameaddict Offline OP
Junior Member
gameaddict  Offline OP
Junior Member

Joined: Apr 2010
Posts: 59
Lagos, Nigeria
Wow! I found the problem. Apparently, my SED gets confused when I put comments this way like after c_move in the handle_movement function in player.c:

WRONG!!
function do_stuff()
{// i want this to do something
var a;
var b;
play(young forever, jay z... just kidding);
}

CORRECT!!
function do_stuff()
{
// i want this to do something
var a;
var b;
play(beethoven No. 9... just kidding);
}


Thanks guys. I'll post if there's further problems. You guys rock!!!


I know I can.
Page 4 of 5 1 2 3 4 5

Moderated by  HeelX, Lukas, rayp, Rei_Ayanami, Superku, Tobias, TWO, VeT 

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