블로그 이미지
Leeway is... the freedom that someone has to take the action they want to or to change their plans.
maetel

Notice

Recent Post

Recent Comment

Recent Trackback

Archive

calendar

1 2 3 4
5 6 7 8 9 10 11
12 13 14 15 16 17 18
19 20 21 22 23 24 25
26 27 28 29 30 31
  • total
  • today
  • yesterday

Category

2007. 6. 18. 01:32 Code/NodeBox

size(300,300)
speed(100)

def setup():
    global x
    global y
    global vx
    global vy
    
    x=150   #initial position
    y=150
    vx=10   #initial velocity
    vy=15
    
    
def draw():
    global x
    global y
    global vx
    global vy
    
    c=0.01  #viscosity
    r=1.1   #repulsive force
    
    ax=-vx*c
    ay=-vy*c
    vx+=ax
    vy+=ay
    x+=vx
    y+=vy

 
     
    if (x>WIDTH):
        vx*=-r
        x=WIDTH

    if (x<0):
        vx*=-r
        x=0

    if (y>HEIGHT):
        vy*=-r
        y=HEIGHT    

    if (y<0):
        vy*=-r
        y=0    

    oval(x,y,20,20) 

'Code > NodeBox' 카테고리의 다른 글

ping_class  (0) 2007.06.20
ping_multi  (0) 2007.06.18
splash  (0) 2007.06.17
progress  (0) 2007.06.14
range()  (0) 2007.06.14
posted by maetel