We are about to switch to a new forum software. Until then we have removed the registration on this forum.
Hello,
I wanted to make this restart from the left side if it reached the other end. frameCount is used to shift the position every frame. Is it possible to reset frameCount to 0 after the x reaches 480 ?
def draw():
# Tipp: Die Draw-methode wird in processing in einer endlosschleife aufgerufen
global prev
global white
time = frameCount
noStroke()
transparenz = color(white,64)
fill(transparenz)
rect(0,0,580,200)
stroke(0,0,0,255)
x = time * 40
y = 100
drawSurfer(x,y)
sry for the dumb question, im fairly new to programming
Answers
Time=framecount%120
Yes, using the modulo operator, like Chrisir suggested. Just replace line 5 with:
time = frameCount % 12;
Thank you both for the very fast answers ! it works :)
No problem. :) Just out of curiosity, is this for school or university?
Yes it's for university.