Thanks a lot, this is what I need, gonna try this right away
This section allows you to view all posts made by this member. Note that you can only see posts made in areas you currently have access to.
$some_variable[:instance].long_function_name('param1','param2',1,2,3)
$some_variable
[:instance].long_function_name
('param1','param2',1,2,3)
FPS = 40
class Animated < Sprite
attr_accessor :in_animation
@in_animation = false
def initialize
#assign some picture for this class
end
def move(distance,duration) #distance = distance to travel in pixels ; #duration = time for travel distance in seconds
#declaration of variables which I think necessary for acceleration/deceleration
@distance_total = distance
@distance_covered = 0
@distance_remaining = @distance_total
@time_total = FPS * duration
@time_spent = 0 #in frames
@time_remaining = @time_total #in frames
@current_speed = 0
@last_speed = 0
@speed_type = 'constant';
@in_animation = true
end
def animate()
#calculate how many pixel to move in a frame
@current_speed = @distance_total/@time_total
#move the thing to left (
$yeah.x -= current_speed
#set some variables
@distance_covered += @current_speed
@time_spent += 1
#ends the animation if the object has reach the destination
if @distance_covered >= @distance_total && @time_spent >= @time_total
@in_animation = false
end
end
end
if $yeah.in_animation == true
$yeah.animate()
end
$yeah = Animated.new
$yeah.move(100,1)
Quote from: gameus on September 11, 2012, 07:42:51 pm
http://www.youtube.com/watch?v=wcLNteez3c4&feature=relmfu
There's just something really sexy about that chick.