Gamestudio Links
Zorro Links
Newest Posts
Change chart colours
by 7th_zorro. 05/11/24 09:25
Data from CSV not parsed correctly
by dr_panther. 05/06/24 18:50
AUM Magazine
Latest Screens
The Bible Game
A psychological thriller game
SHADOW (2014)
DEAD TASTE
Who's Online Now
2 registered members (AndrewAMD, Ayumi), 1,405 guests, and 4 spiders.
Key: Admin, Global Mod, Mod
Newest Members
Hanky27, firatv, wandaluciaia, Mega_Rod, EternallyCurious
19051 Registered Users
Previous Thread
Next Thread
Print Thread
Rate Thread
Page 7 of 8 1 2 3 4 5 6 7 8
Re: [REQ] converting a code to lite-c [Re: Cowabanga] #251510
02/13/09 13:03
02/13/09 13:03
Joined: Feb 2008
Posts: 3,232
Australia
EvilSOB Offline
Expert
EvilSOB  Offline
Expert

Joined: Feb 2008
Posts: 3,232
Australia
Hmm, I'll need to think on that one, but it'll be easy enough I think.
BUT, do you want it to "need to press left mouse button" to move them, or just purely on contact?

[EDIT]Heres the code update to make the enemy move when "hit" by attacking hands.
(Making the enemies move when just bumped into too much work. Write a new action to do that.)

WHOLE enemy.c(though only one "paragraph" added)
Click to reveal..
Code:
action enemy_dummy()
{
	set(my,SHADOW);
	my.entity_type = 2;
	my.emask |= ENABLE_SCAN;
	while(1) 
	{
		if(my.hit_by_player == 1)	//sucessful attack by player weapon
		{
			my.move_x = player.move_x;
			my.move_y = player.move_y;
			my.move_z = player.move_z;
			c_move(my, nullvector, my.move_x, USE_BOX | IGNORE_PASSABLE | GLIDE);
			if(player.animblend == blend || player.animblend < attack_a || my.animblend > attack_f)	my.hit_by_player = 0; 
		}
		else if(my.hit_by_player == 2)	//sucessful HAND attack by player
		{
			my.move_x = player.move_x;
			my.move_y = player.move_y;
			my.move_z = player.move_z;
			c_move(my, nullvector, my.move_x, USE_BOX | IGNORE_PASSABLE | GLIDE);
			if(player.animblend == blend || player.animblend < attack_a || my.animblend > attack_f)	my.hit_by_player = 0; 
		}
		if((player.animblend >= stand && target_enemy == me && player_lock_on == 0) && (player.animblend < attack_a || player.animblend > attack_f))
			target_enemy = NULL;
		if(target_enemy == my && vec_dist(my.x, player.x) > 200)		
			target_enemy = NULL;
		wait(1);
	}
}

PARTIAL player.c(two functions to replace handle_sword_collisions(), found at end of script)
Click to reveal..
Code:
function handle_hand_collision()
{
	vec_for_vertex(tempV.x, player, 1146); 	//thumb tip
	vec_for_vertex(tempV2.x, player, 1144); 	//thumb joint
	result = c_trace(tempV.x, tempV2.x, IGNORE_ME | IGNORE_PASSABLE | USE_BOX);
	if(you != NULL) 
	{
		if(you.entity_type == 2 && you.hit_by_player == 0) 
		{
			if(airborne_attack == 1 && my.animblend == attack_a)		my.movement_mode = 2;
			you.hit_by_player = 2;
			if(target_enemy == NULL)				{ target_enemy = you; player_lock_on = 1; }
		}
	}
}

function handle_sword_collision()
{
	you = NULL;
	if(player_weapon==NULL)		{	handle_hand_collision();	return;	}
	vec_for_vertex(tempV.x, player_weapon, 274); //sword base
	vec_for_vertex(tempV2.x, player_weapon, 54); //sword tip
	result = c_trace(tempV.x, tempV2.x, IGNORE_ME | IGNORE_PASSABLE | USE_BOX);
	if(you != NULL) 
	{
		if(you.entity_type == 2 && you.hit_by_player == 0) 
		{
			if(airborne_attack == 1 && my.animblend == attack_a)		my.movement_mode = 2;
			you.hit_by_player = 1;
			if(target_enemy == NULL)				{ target_enemy = you; player_lock_on = 1; }
		}
	}
}



Last edited by EvilSOB; 02/13/09 13:53. Reason: research/re-code completed

"There is no fate but what WE make." - CEO Cyberdyne Systems Corp.
A8.30.5 Commercial
Re: [REQ] converting a code to lite-c [Re: EvilSOB] #251515
02/13/09 13:58
02/13/09 13:58
Joined: Feb 2008
Posts: 3,232
Australia
EvilSOB Offline
Expert
EvilSOB  Offline
Expert

Joined: Feb 2008
Posts: 3,232
Australia
A NOTE TO ALL USING MY RE-CODE!

I discovered an instability in my code during my last bit of research,
if youve already copied my code from above you'll need to change the following.
(Ive updated my above code post so this has been fixed there)

In ENEMY.C the following line must be changed
Code:
c_move(my, nullvector, my.move_x, USE_AABB | IGNORE_PASSABLE | GLIDE);
    must be changed to
c_move(my, nullvector, my.move_x, USE_BOX | IGNORE_PASSABLE | GLIDE);



"There is no fate but what WE make." - CEO Cyberdyne Systems Corp.
A8.30.5 Commercial
Re: [REQ] converting a code to lite-c [Re: EvilSOB] #251521
02/13/09 14:23
02/13/09 14:23
Joined: Aug 2008
Posts: 2,838
take me down to the paradise c...
Cowabanga Offline OP
Expert
Cowabanga  Offline OP
Expert

Joined: Aug 2008
Posts: 2,838
take me down to the paradise c...
OK! Thanks. But now i replaced enemy.c by the new one

and i updated function handle_sword_collision and i put handle_hand_collision.

Now how can i activate the hand?

Re: [REQ] converting a code to lite-c [Re: Cowabanga] #251526
02/13/09 14:47
02/13/09 14:47
Joined: Feb 2008
Posts: 3,232
Australia
EvilSOB Offline
Expert
EvilSOB  Offline
Expert

Joined: Feb 2008
Posts: 3,232
Australia
With the two bits of code I just gave you, it should already be running.
Face the enemy from close, hit left-mouse click and you will run through the normal attack animations,
and it will push the enemy back.

No other mode besides the new enemy.c and the modded handle_???_collision functions.


"There is no fate but what WE make." - CEO Cyberdyne Systems Corp.
A8.30.5 Commercial
Re: [REQ] converting a code to lite-c [Re: EvilSOB] #251529
02/13/09 15:04
02/13/09 15:04
Joined: Aug 2008
Posts: 2,838
take me down to the paradise c...
Cowabanga Offline OP
Expert
Cowabanga  Offline OP
Expert

Joined: Aug 2008
Posts: 2,838
take me down to the paradise c...
Thank you very much! This is good to thank you wink :

http://www.flashgamecodes.ca/games/84e5f721da67.swf

And BTW, I'll put the converted code in the wiki and i'll put your name as the converter. Ok?

EDIT: How can i make the player move using WASD or UP DOWN LEFT RIGHT?

Last edited by Cowabanga; 02/13/09 15:19.
Re: [REQ] converting a code to lite-c [Re: Cowabanga] #251538
02/13/09 16:10
02/13/09 16:10
Joined: Feb 2008
Posts: 3,232
Australia
EvilSOB Offline
Expert
EvilSOB  Offline
Expert

Joined: Feb 2008
Posts: 3,232
Australia
Cool, thanks.

And to add the UP DOWN LEFT RIGHT functionality, go to the start of the handle_movement()
function in PLAYER.C and add the following just before or after the other big block of if's.
[you'll see where I mean, as long as its before the line "if(tempV.x != -1000)"]
Code:
	if(key_cuu == 1 && key_cud == 0 && key_cul == 0 && key_cur == 0)	tempV.x = camera.pan;
	if(key_cud == 1 && key_cuu == 0 && key_cul == 0 && key_cur == 0)	tempV.x = camera.pan + 180;
	if(key_cul == 1 && key_cud == 0 && key_cuu == 0 && key_cur == 0)	tempV.x = camera.pan + 90;
	if(key_cur == 1 && key_cud == 0 && key_cur == 0 && key_cuu == 0)	tempV.x = camera.pan - 90;
	if(key_cuu == 1 && key_cul == 1 && key_cud == 0 && key_cud == 0)	tempV.x = camera.pan + 45;
	if(key_cuu == 1 && key_cur == 1 && key_cul == 0 && key_cud == 0)	tempV.x = camera.pan - 45;
	if(key_cud == 1 && key_cul == 1 && key_cur == 0 && key_cuu == 0)	tempV.x = camera.pan + 135;
	if(key_cud == 1 && key_cur == 1 && key_cul == 0 && key_cuu == 0)	tempV.x = camera.pan - 135;




"There is no fate but what WE make." - CEO Cyberdyne Systems Corp.
A8.30.5 Commercial
Re: [REQ] converting a code to lite-c [Re: EvilSOB] #251543
02/13/09 16:55
02/13/09 16:55
Joined: Aug 2008
Posts: 2,838
take me down to the paradise c...
Cowabanga Offline OP
Expert
Cowabanga  Offline OP
Expert

Joined: Aug 2008
Posts: 2,838
take me down to the paradise c...
Wow! Thanks!

Re: [REQ] converting a code to lite-c [Re: Cowabanga] #251544
02/13/09 16:59
02/13/09 16:59
Joined: Feb 2008
Posts: 3,232
Australia
EvilSOB Offline
Expert
EvilSOB  Offline
Expert

Joined: Feb 2008
Posts: 3,232
Australia
No problem. Im just amazed at how much I seem to have learned in the last
couple of months, without even noticing it...


"There is no fate but what WE make." - CEO Cyberdyne Systems Corp.
A8.30.5 Commercial
Re: [REQ] converting a code to lite-c [Re: EvilSOB] #251549
02/13/09 17:21
02/13/09 17:21
Joined: Aug 2008
Posts: 2,838
take me down to the paradise c...
Cowabanga Offline OP
Expert
Cowabanga  Offline OP
Expert

Joined: Aug 2008
Posts: 2,838
take me down to the paradise c...
See: http://www.opserver.de/wiki/index.php/Original_Kingdom_Hearts_Movement

I putted the code and your name and the add-ons etc. smile

Re: [REQ] converting a code to lite-c [Re: testDummy] #251558
02/13/09 18:20
02/13/09 18:20
Joined: Aug 2008
Posts: 2,838
take me down to the paradise c...
Cowabanga Offline OP
Expert
Cowabanga  Offline OP
Expert

Joined: Aug 2008
Posts: 2,838
take me down to the paradise c...
BTW, How can i make a double jump and hang?

And how can i make a rotate camera?
Download here, Please! smile
But with less rotating.

Last edited by Cowabanga; 02/13/09 18:49.
Page 7 of 8 1 2 3 4 5 6 7 8

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

Gamestudio download | chip programmers | 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