This going to sound crazy, but it's given me an insane headache.
I'm trying to make something simply bob up and down. Got up 10 points, come down 10 points (the starting position), preferably 'eased'. I don't suppose someone could help me?
Thanks :)
sounds like the motion of the ball in the 'Drop' game by dominic. Source code's available at
http://impactjs.com/documentation/drop-source-code
Thanks fugufish, didn't really help thought as that's based on the bounciness set of it. Mine is a simple "if the entity is 10 points above where it spawned move it down 10 points. If the it's 10 points below where it spawned, move it up 10 points."
It sort of depends what this entity does. Is it a random character pacing back and forth or is it the main character? How is the screen divided up? I always make the center 0 so for my code it'd work a little like this.
If ( this.pos.y >= 5)
{ this.vel.y=-50 // Play around with speed until you find the one you want
}
else if (this.pos.y <=-5)
{ this.vel.y= 50
}
Page 1 of 1
« first
« previous
next ›
last »