Gamestudio Links
Zorro Links
Newest Posts
AlpacaZorroPlugin v1.3.0 Released
by kzhao. 05/20/24 01:28
Free Live Data for Zorro with Paper Trading?
by AbrahamR. 05/18/24 13:28
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), 838 guests, and 2 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
strafing 100 quants #395202
02/20/12 22:18
02/20/12 22:18
Joined: Sep 2006
Posts: 292
M
Mythran Offline OP
Member
Mythran  Offline OP
Member
M

Joined: Sep 2006
Posts: 292
Can someone please tell me how can i or give me an idea of how can i make the player strafe backwards 100 quants and play the full strafe back animation by pressing only once the key?

I tryed this code below, but the player doesn't move...

Code:
if (key_space == 0 && key_space_press == 1)
{
    key_space_press = 0;
}
			
if (key_space == 1 && key_space_press == 0 && key_s)
{
    player.blendframe = unarmedB;
    key_space_press = 1;
    my.strafeForce = 250;
    my.animate2 = 0;
    my.animblend = blend;

    my.strafeForce = maxv(-30, my.strafeForce);
    my.strafeVelocity += (time_step * my.strafeForce) - (minv(time_step * 0.7, 1) * my.strafeVelocity);
    my.strafeSpeed = my.strafeVelocity * time_step;
}



Thanks

Re: strafing 100 quants [Re: Mythran] #395375
02/22/12 21:36
02/22/12 21:36
Joined: Sep 2003
Posts: 5,900
Bielefeld, Germany
Pappenheimer Offline
Senior Expert
Pappenheimer  Offline
Senior Expert

Joined: Sep 2003
Posts: 5,900
Bielefeld, Germany
You need a condition that applies regardless of whether any key is pressed or not. Within that conditionyou have to proove whether the strafe is fullfilled, means whether the player moved the full 100 quants, then you can switch keyspace_press back...

Re: strafing 100 quants [Re: Mythran] #396544
03/07/12 20:48
03/07/12 20:48
Joined: Mar 2012
Posts: 927
cyberspace
W
Wjbender Offline
User
Wjbender  Offline
User
W

Joined: Mar 2012
Posts: 927
cyberspace
var can_press_space=1;//(global variable)yes can enter function
if(key_space==1 && can_press_space==1)
{
can_press_space=0;// disable ability to enter function over here
var distance_moved=0;
while(distance_moved<100)
{
can_press_space=0;//perhaps here
//move and increase distance_moved with the distance you move each frame
wait(1);
}
can_press_space=0;//or over here ,one of these 3 positions ?
}
if(key_space==0)can_press_space=1;//yes can enter function again..
also then use c_move or whatever method of moving


Compulsive compiler
Re: strafing 100 quants [Re: Wjbender] #396648
03/08/12 20:14
03/08/12 20:14
Joined: Sep 2006
Posts: 292
M
Mythran Offline OP
Member
Mythran  Offline OP
Member
M

Joined: Sep 2006
Posts: 292
Thank you very much! laugh


Moderated by  adoado, checkbutton, mk_1, Perro 

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