week4_motion_of_ball_1(小球运动)——改进
2014-10-18 10:53
309 查看
# Ball motion with an explicit timer import simplegui # Initialize globals width = 600 height = 600 ball_pos = [width/2, height/2] ball_radius = 20 ball_vel = [0, 1.0]#(pixels per 1/60seconds) # define event handlers def draw(canvas): global ball_pos, ball_vel # calculate ball position,use p(t+1) = p(t) + v(t) ball_pos[0] = ball_pos[0] + ball_vel[0] ball_pos[1] = ball_pos[1] + ball_vel[1] # draw ball canvas.draw_circle(ball_pos, ball_radius, 6, 'white') # create frame frame = simplegui.create_frame('ball_motion', 600, 600) # register event handlers frame.set_draw_handler(draw) # start frame frame.start()
相关文章推荐
- week4_motion_of_ball_1(小球运动)——改进
- week4_motion_of_ball_1(小球运动)——最基本
- week4_motion_of_ball_1(小球运动)——最基本
- Swift - 加速传感器(CoreMotion)的用法,小球加速运动并反弹样例
- IIPP Week 4 - Lists, keyboard input, the basics of modelling motion
- Swift - 加速传感器(CoreMotion)的用法,小球加速运动并反弹样例
- Guru of the Week 条款15:类之间的关系(下篇)
- 关于Calendar.WEEK_OF_YEAR中西方约定不同的问题
- Python Module of the Week - Python Module of the Week
- Java中Calendar.DAY_OF_WEEK、DAY_OF_MONTH需要减一的原因
- Summary of this week, Dec.21,2013
- motion offset(color accumulation)运动模糊特效
- Java中Calendar.DAY_OF_WEEK需要减一的原因
- 打小球游戏(Brick & Ball)最终完美版:C语言实现
- Cocos2d入门--3--小球运动
- 题目1043:Day of Week
- Summary of this week-Sep. 7,2013
- DB2或MySql的week_iso或weekOfYear()与java的Calendar.WEEK_OF_YEAR保持一致
- HTML5 做波形运动的小球
- Mathematics of Motion Control