|
2 registered members (Petra, 1 invisible),
6,267
guests, and 2
spiders. |
|
Key:
Admin,
Global Mod,
Mod
|
|
|
Bounce without changing angle...
#170670
12/02/07 18:47
12/02/07 18:47
|
Joined: Apr 2006
Posts: 36
pwy
OP
Newbie
|
OP
Newbie
Joined: Apr 2006
Posts: 36
|
Hello, I have 3DGS 7. OK. This is driving me nuts! How do I make a character bounce "away" from an enemy when hit? I've read quite a bit about "bounce" and "vec_to_angle"--but, I don't want the player's angle/pan to change. If the enemy hits the front, back or side of the player, then shoot the player in that direction. Does that make since? Thanks in advance for any help. I could use a point in the right direction... "No pun intended" 
|
|
|
Re: Bounce without changing angle...
[Re: Scorpion]
#170672
12/03/07 16:43
12/03/07 16:43
|
Joined: Apr 2006
Posts: 36
pwy
OP
Newbie
|
OP
Newbie
Joined: Apr 2006
Posts: 36
|
I've tried a million ways. I can't get it to work.  I have very limited vector math skills. Here's one of the ways I tried doing what you said: ... if( bounce.x != 0 ){ vec_scale( bounce.x , 5 ); vec_set( playerMove.x , bounce.x ); } ... c_move( my , playerMove , nullvector , etc.. ); Don't laugh.
|
|
|
Re: Bounce without changing angle...
[Re: pwy]
#170673
12/03/07 16:49
12/03/07 16:49
|
Joined: Jan 2006
Posts: 968
EpsiloN
User
|
User
Joined: Jan 2006
Posts: 968
|
I dont want to script anything right now , but I'd suggest you another way : On collision , store player pan and change it to the bounce direction for relative movement (not absolute!). After that , retreive the original player pan. Your entity will appear to be always facing the same angle and move in a diffrent direction. Another suggestion is , decrease the diffrence between the two pan angles after a collision with bounce and you'll get a spherical movement , as if the force pushing the player in another way is decreasing. You could do this pure mathematicaly with vectors & forces , but sometimes the 'ordinary' way isnt the easyest  (I'm no good at math!)
|
|
|
Re: Bounce without changing angle...
[Re: pwy]
#170675
12/04/07 02:59
12/04/07 02:59
|
Joined: Apr 2006
Posts: 36
pwy
OP
Newbie
|
OP
Newbie
Joined: Apr 2006
Posts: 36
|
OK, That last code was pointless obviously.  This seems to work. But, she goes shooting off the screen way to quickly! Any ideas? Thanks for any help you may have. CODE------------------------------------------------------ ... var bounceDir; ... function lanaHit(){ if( event_type == EVENT_IMPACT || event_type == EVENT_ENTITY ){ bounceDir = bounce; }//end if }//end function //Action------------- ACTION lana_action(){ lana = my; clip_size = 0; wait( 1 ); c_setminmax( my ); my.ENABLE_ENTITY = on; my.ENABLE_IMPACT = on; my.ENABLE_SCAN = on; my.x = 0; my.y = 0; my.z = 0; my.skill1 = 0; //isHit my.event = lanaHit; while( my ){ if( my.skill1 == 0 ){ //is not hit lanaMove.x = speed; lanaMove.y = 0; lanaMove.z = 0; }else{ vec_scale( bounceDir , 2 ); vec_set( lanaMove , bounceDir ); }//end if c_move( my , lanaMove , nullvector , GLIDE | IGNORE_PASSABLE ); c_scan( my.x , my.pan , vector( 360 , 180 , 360 ) , SCAN_LIMIT | IGNORE_ME ); wait( 1 ); }//end while }//end action //Action------------ CODE------------------------------------------------------
|
|
|
|