Gah nevermind, found the problem. Just had to throw a 'clear' into the
animate loop. Sorry!

On Thu, Oct 9, 2008 at 11:33 AM, Timothy McDowell <[EMAIL PROTECTED]>wrote:

> So, with my code I want all the players to be drawn ten times a second
> (Thats what 'animate(10) do' does, right?) and I want to see if the player
> controlled by YOU, the player, to move if the up key is pressed. I know I
> need to change the x/y things (Currently he would most likely move sideways)
> but that isn't the real issue. The square just grows instead of moving...
> any thoughts?
> It's small code so I will include it here.
>     $players = []
> class Player
> attr_accessor(:x, :y)
>  def initialize(x, y)
> $players << self
>  @x = x
> @y = y
> end
> end
> bob = Player.new(100, 100)
> quit_flag = false
>
> Shoes.app(:title => "Game Test", :width => 500, :height => 500, :resizable
> => false) {
> until quit_flag == true
>  $players.each do |p|
> rect(p.x, p.y, 50, 50)
> end
>  keypress do |k|
> if k == :up
> $players[0].x += 5
>  end
> end
> end
> }
> --
> --Sincerely,
>       TLM
>



-- 
--Sincerely
     His awesome, dope, freshness.

Reply via email to