Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR PYTHON

move object towards coordinate slowly pygame

# move object towards position
ax,ay=(20,30)
bx,by=(40,60)
steps_number = max( abs(bx-ax), abs(by-ay) )

stepx = float(bx-ax)/steps_number
stepy = float(by-ay)/steps_number

for i in range(steps_number+1):
    print int(ax + stepx*i), int(ay + stepy*i)
Source by stackoverflow.com #
 
PREVIOUS NEXT
Tagged: #move #object #coordinate #slowly #pygame
ADD COMMENT
Topic
Name
3+3 =