Fruit ninja
DreamLab
Member Posts: 2,127
Out of my own boredom and curiosity I was looking at fruit ninja templates. Unlike the fruit ninja game, the templates only cut the fruit at a certain angle no matter how you cut them. I want to know how you would get the fruit to cut at whatever angle you swipe the blade at. PLEASE COMMENT
thanks
DL
thanks
DL
Comments
I think you could hire Orbz to take a crack at it, he was offering his services in Nov/Dec for a really good price, and he is incredible at math
Send and Receive Data using your own Server Tutorial! | Vote for A Long Way Home on Steam Greenlight! | Ten Years Left
I believe for that you would need to draw the fruits in real time by pixel. That would be hard even with coding in xcode and it is impossible in GS.
get the angle of the vector (in a rule if sword collide with fruit then startX = position.X, startY = position.y, otherwise endX = position.X, endY = position.y), then you do a vectorToAngle (startX-endX, startY-endY (or viceversa, endX - startX etc) and get the angle that the cut was at. you just make the fruit disappear, set or spawn two half of the fruit (to simplify things, do not draw the half in a separate image, draw it in a canvas the same size of the fruit, and put it like you must do a puzzle to set back the full fruit (can't really explain better xD)).
Those two half, if are like I described, must be set to the same x and y position of the slashed fruit. Their rotation then, must be set to that of the vector to angle, a little adjusted (would have to test to sort it out perfectly), and you put some logic to make them "do that little jump" and fall towards the bottom.
This is all theorically though, never tested xD So can't be 100% sure.