Injury wrote:
How would I script hit detection for the x axis?
IE 2d side scrolling thing
[X] is character, =X is the hit detection
[X]=====X
or possibly in all 8 directions??
variables are related to the hit detection, the length of the "beam" and the x,y origin that I can apply an animation too
I might have to push all of this into Unity...or figure out how to make assets in rmxp feel like they are viewed from a straight angle.
In XP, you should be able to call $game_player.passable?(x,y,d).IE 2d side scrolling thing
[X] is character, =X is the hit detection
[X]=====X
or possibly in all 8 directions??
variables are related to the hit detection, the length of the "beam" and the x,y origin that I can apply an animation too
I might have to push all of this into Unity...or figure out how to make assets in rmxp feel like they are viewed from a straight angle.
This means all you have to do is set a multiplier to specify the direction (-1 for left, 0 for no change, 1 for right, -1 for up, 0 for no change, 1 for down) and loop through from 0 to length of the direction to be tested.
eg. (NOT TESTED)
- dir = [0,-1] # (x,y), in this case, up
- len = 6 # tiles length
- pl = $game_player
- valid = true
- for i in 0...len
- valid = false if !pl.passable?(pl.x+(dir[0]*i),pl.y+(dir[1]*i),pl.direction)
- end
- pass
- # pass now will tell you if you hit anything
Expand to see the code.
