Posted By: Realspawn
Using sprites - 10/09/15 23:35
i am trying to use the bouncing script on a sprite. However
the sprite does not appear flat but gets rotated 90 degrees. The game is top view dus de sprite has to be visible while now its not.
how to i change this script so it will work ?
any ideas ? I tried pan tilt and roll settings but no effect.
the sprite does not appear flat but gets rotated 90 degrees. The game is top view dus de sprite has to be visible while now its not.
how to i change this script so it will work ?
any ideas ? I tried pan tilt and roll settings but no effect.
Code:
function bounce_off() // ball's event function { vec_to_angle(my.pan, bounce); // change the direction as expected from a "real" ball my.pan += 5 - random(10); // add some randomness at each collision (don't allow the ball to get stuck) } action my_sprite() // attach this action to your ball { my.emask |= (ENABLE_BLOCK | ENABLE_ENTITY); // the object is sensitive to block and entity collisions my.event = bounce_off; while(1) { c_move(me, vector(5 * time_step, 0, 0), nullvector, IGNORE_PASSABLE | GLIDE); // move ahead, in the direction given by the pan angle wait(1); } }