From: Ruby Student Date: 2013-06-06T22:15:13+09:00 Subject: Re: My car is "falling" off the screen green shoes --20cf30781330ad067504de7c1a7f Content-Type: text/plain; charset=ISO-8859-1 Hi Martin, I defined my screen as "fullscreen" and I don't know how to tell the actual size in order to control the car movements. I have the following: *Shoes.app fullscreen: true, :title => "VRMQMon", :resizable => true do * 1. How does one determine the size of the screen while in full screen? 2. How can I tell when the car reached the edges? Thank you On Wed, Jun 5, 2013 at 6:08 PM, Martin DeMello wrote: > Hint: Check out the mod function (%). For instance, if you have a > screen of width 20, a car at position 10, and it moves 15 units in > either direction: > > irb(main):001:0> a = 10 > => 10 > irb(main):002:0> b = a + 15 > => 25 # <--- gone off the right edge > irb(main):003:0> c = (a + 15) % 20 > => 5 # <--- wrapped around > irb(main):004:0> d = a - 15 > => -5 # <--- gone off the left edge > irb(main):005:0> e = (a - 15) % 20 > => 15 # <--- wrapped around > > martin > > On Wed, Jun 5, 2013 at 9:08 AM, Ruby Student > wrote: > > Team, > > > > I am having so much fun with shoes!!!!!!!!!!!!!!!! > > > > But, I have a problem. I finally made my car image moves from left to > right. > > But it reaches the end of the screen on the right and it disappears. Can > > anyone help me keep my car return back to the starting pint, which is the > > left bottom of the screen? I want for that to happen continuously. The > > following is the actual code I'm using: > > > > > > @carim = image "/home/rstudent/MyData/Programs/shoes/car1.png" > > every 6 do > > animate do |i| > > @carim.left += (-20..50).rand > > end > > end > > > > Any help will be appreciated. > > > > -- > > Ruby Student > > -- Ruby Student --20cf30781330ad067504de7c1a7f Content-Type: text/html; charset=ISO-8859-1 Content-Transfer-Encoding: quoted-printable
Hi Martin,

I defined my screen as &= quot;fullscreen" and I don't know how to tell the actual size in o= rder to control the car movements. I have the following:
Shoes.app fu= llscreen: true, :title =3D> "VRMQMon", :resizable =3D> true= =A0 do

  1. How does one determine the size of the screen while in full= screen?
  2. How can I tell when the car reached the edges?

Thank you



On Wed, Jun 5, 2013 at 6:08 PM, Martin D= eMello <martindemello@gmail.com> wrote:
Hint: Check out the mod function (%). For instance, if you have a
screen of width 20, a car at position 10, and it moves 15 units in
either direction:

irb(main):001:0> a =3D 10
=3D> 10
irb(main):002:0> b =3D a + 15
=3D> 25 =A0# <--- gone off the right edge
irb(main):003:0> c =3D (a + 15) % 20
=3D> 5 =A0# <--- wrapped around
irb(main):004:0> d =3D a - 15
=3D> -5 =A0# <--- gone off the left edge
irb(main):005:0> e =3D (a - 15) % 20
=3D> 15 =A0# <--- wrapped around

martin

On Wed, Jun 5, 2013 at 9:08 AM, Ruby Student <ruby.student@gmail.com> wrote:
> Team,
>
> I am having so much fun with shoes!!!!!!!!!!!!!!!!
>
> But, I have a problem. I finally made my car image moves from left to = right.
> But it reaches the end of the screen on the right and it disappears. C= an
> anyone help me keep my car return back to the starting pint, which is = the
> left bottom of the screen? I want for that to happen continuously. The=
> following is the actual code I'm using:
>
>
> =A0 =A0 @carim =3D image =A0"/home/rstudent/MyData/Programs/shoes= /car1.png"
> =A0 =A0 every 6 do
> =A0 =A0 =A0 =A0animate do |i|
> =A0 =A0 =A0 =A0 =A0 @carim.left +=3D (-20..50).rand
> =A0 =A0 =A0 =A0end
> =A0 =A0 end
>
> Any help will be appreciated.
>
> --
> Ruby Student




--
Ruby Studen= t
--20cf30781330ad067504de7c1a7f--