YesNoOk
avatar

Wall Bounce (Read 5765 times)

Started by Javon, April 04, 2017, 02:45:35 am
Share this topic:
Wall Bounce
#1  April 04, 2017, 02:45:35 am
  • avatar
  • *
    • USA
Can someone tell me what the thing is call if p2 hits the wall,i made p1 did it before,i forgot what it was?
Re: Wall Bounce
#2  April 05, 2017, 09:11:22 am
  • **
  • Déjà vu, mayhap—have you been here as well?
If you mean the trigger for when they hit the wall, it should be "BackEdgeBodyDist".

For example, if you want something to trigger when p2 is 20 pixels (or less) away from the wall you should use:

trigger1 = BackEdgeBodyDist < 20
Re: Wall Bounce
#3  April 05, 2017, 11:56:56 am
  • avatar
  • *
    • USA
Which statedef number should i put that in?
Re: Wall Bounce
#4  April 05, 2017, 06:57:27 pm
  • **
  • Déjà vu, mayhap—have you been here as well?
The trigger is supposed to be inside a State (which is inside a Statedef)
I suppose you want to use it on the Statedef for the attack that pushes p2 to the wall
Re: Wall Bounce
#5  April 06, 2017, 12:09:54 am
  • avatar
  • *
    • USA
The trigger is supposed to be inside a State (which is inside a Statedef)
I suppose you want to use it on the Statedef for the attack that pushes p2 to the wall

do i have to add statedef number 13957 to it,i tried what you said but it didn't work
Re: Wall Bounce
#6  April 06, 2017, 12:53:40 am
  • avatar
  • *
    • USA
Last Edit: April 06, 2017, 12:58:17 am by Javon
Re: Wall Bounce
#7  April 06, 2017, 07:07:51 am
  • **
  • Déjà vu, mayhap—have you been here as well?
Hmm, the link you posted doesnt seem to work, it looks like you copied the URL to a video you were editing, not one I can watch, but I think i know what you mean.
Also, sorry I meant you have to use the BackEdgeBodyDist the for "state" that pushes the p2, not the "attack". Ill post a working example and explain:


The first custom state has a "aerial" type, it doesnt really change anything in this situation i think, it HAS to be "movetype = H" because its a state that he is getting hit , physics is "N" so gravity wont affect him during the state, on "anim = 201" my animation was a single frame of the sprite 5000,0 (doesnt have to be that way) [ALSO REMEMBER TO PUT HITBOXES IN THE ANIMATIONS] , VelSet is going to move him until he hits the wall , and the ChangeState is going to change his state when he is 30 pixels or less away from the wall (changing it to 202).

The second custom state is the "bouncing off the wall" animation, this one has physics = S so gravity will pull him down, the "anim = 202" [DONT FORGET HITBOXES] was the same sprite as 201 (my choice of course) , Turn is going to make him change directions when he hits the wall (you dont need to use it , its optional , but if you remove it VelSet X has to be positive) , EnvShake is going to shake the screen for added effect, VelSet will move him away from the wall,  and SelfState is going to put him on the default "falling" state, to avoid him getting stuck/falling through the floor (You can fix it but its a bit more complicated). You can hit him after he bounces off the wall (if you put hitboxes)


;--------------------------------------------------------------------------------------------
;Flying towards the wall
[Statedef 201]
type = A                     
movetype = H 
physics = N
ctrl = 0
anim = 201
sprpriority = 2

[State 0, VelSet]
type = VelSet
trigger1 = Time = 0
x = -6
y = -1
ignorehitpause = 1

[State 0, ChangeState]
type = ChangeState
trigger1 = BackEdgeBodyDist <= 30
value = 202
ctrl = 0
ignorehitpause = 1


;--------------------------------------------------------------------------------------------
;Hitting off wall
[Statedef 202]
type = A
movetype = H
physics = S
ctrl = 0
anim = 202
sprpriority = 2

[State 0, Turn]
type = Turn
trigger1 = Time = 0
ignorehitpause = 1

[State 0, EnvShake]
type = EnvShake
trigger1 = Time = 0
time = 20
freq = 100
ampl = -5
ignorehitpause = 1

[State 0, VelSet]
type = VelSet
trigger1 = Time = 0
x = -3
y = -5
ignorehitpause = 1


[State 0, SelfState]
type = SelfState
trigger1 = Time = 0
value = 5050
ctrl = 0
ignorehitpause = 1

;--------------------------------------------------------------------------------------------




Re: Wall Bounce
#8  April 06, 2017, 07:16:35 am
  • **
  • Déjà vu, mayhap—have you been here as well?
Also make sure your attack has "p2stateno =" in it, with the example it would be "p2stateno = 201" , and you can remove the "Turn" state if you want, if you hit him with the same move while he is in the air he will glitch
Last Edit: April 06, 2017, 07:30:09 am by DingusMB
Re: Wall Bounce
#9  April 07, 2017, 03:02:47 am
  • avatar
  • *
    • USA
What do I do when he glitches?
Re: Wall Bounce
#10  April 07, 2017, 07:36:19 am
  • **
  • Déjà vu, mayhap—have you been here as well?
You can just not use "Turn", or mess with p2facing on the attack hitdef to get him to look at you when you hit him
but did the code work for you?
Re: Wall Bounce
#11  April 07, 2017, 11:10:31 am
  • avatar
  • *
    • USA
You can just not use "Turn", or mess with p2facing on the attack hitdef to get him to look at you when you hit him
but did the code work for you?

I got the bounce off wall did,but when I put him in statedef 1263 he was glitching and flying away