![]() It'll only ever move at maximum speed, but you shouldn't notice too much. Whack all that into the Updated of the paddle Events, and you should be good to go. If absolute value of (y-center of self - y-center of ball) < half the height of the paddle, then set the y-speed to 0. If I dont keep building up on my skills for this then it will make building games in Stencyl very difficult and limited. Set paddle y-speed to -maxSpeed if the ball is above. I plan to keep working this technical skill for a bit longer as coding event blocks is a big part of building a game in Stencyl, which is used for many aspects like controls, attributes, behaviors and animations. Set paddle y-speed to +maxSpeed if the ball is below. (ie, y-center of ball > y-center of paddle means it's below). So, only move if the ball is moving -towards- the paddle.įigure out if the ball is above or below the center of the paddle. Producing digital animated films is a task that requires, among others, skills in graphic design and computer programming among others 15, 16. If it can move infinitely fast it'll be impossible to beat.ĭo you want to hit the ball when it's travelling away from the AI paddle? No. The trick here (as with every programming problem) is to break it down into tiny chunks.įirst, decide which side of the screen the AI paddle is going to be on (left = x ~ 0 right = x ~ screenWidth)ĭecide on a maximum speed (ie, Y (vertical) distance) the paddle can move on each update.
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |