Log In  

@DrakeGraves

Follow
Follow

Hello erreybuddy. I don't have a specific project I'm working on or anything, but it's been bothering me that I don't understand how this works. I do have a pixel that oscillates properly, but I do not understand my own code, so I don't know how to approach having the pixel start at a different point in the oscillation cycle, without the amplitude changing. Here's my current code.

f=0
function _update()
 f+=5
    y = sin((f)/100) * 8 +64
end

function _draw()
    cls()
    pset(64,y,7)
end

If any smarty-pantses could explain why this code works to me like I'm a child, or how to have the pixel start at another point along the wave without changing amplitude (the x and y values of the top and bottom of its current pattern of movement), that'd be great.

I do feel bad asking for something without contributing to the community. Hopefully someday I can give back a little. Thank you all.

P#46323 2017-11-15 14:44 ( Edited 2017-11-15 20:03)

About | Contact | Updates | Terms of Use
Follow Lexaloffle:        
Generated 2019-08-20 17:31 | 0.082s | 2097k | Q:10