Forums Archived

The forums are being archived. See this topic for more information.

[Solved] Problems during the rotation of an image

Get help and support with Rubygame

[Solved] Problems during the rotation of an image

Postby ian130mx » Sun Feb 13, 2011 2:37 pm

Hello,

I'm trying to rotate an image with the Surface#rotozoom method. Actually it is working, the picture rotates as I want, but the problem is that when it rotates the background around the picture "disappear" to let the place to a black square...
Here is what happen when the rotation is applied :
Image

And here is the normal position :
Image

Can you help me to fix that problem ?
Here is the code where I apply the rotation:

Code: Select all
   def spin
      center = @rect.center
      @rotate += 10
      @image = @original.rotozoom(@rotate,1,true)
      @rect.size=[100,100]
      @rect = @image.make_rect()
      @rect.center = center
      if @rotate >= 360
         @image = @original
         @rotate = 0
      end
   end
Last edited by ian130mx on Tue Feb 15, 2011 4:22 pm, edited 1 time in total.
ian130mx
 
Posts: 2
Joined: Sun Feb 13, 2011 2:14 pm

Re: Problems during the rotation of an image

Postby ian130mx » Tue Feb 15, 2011 4:21 pm

Oh it's okay, I found what the problem was...

In the initialization of my surface which was containing the image to spin I had this line that was making my background black...

Code: Select all
@original.set_colorkey( @original.get_at([0,0]) )


So I removed it and it's ok now, sorry for my useless post!
ian130mx
 
Posts: 2
Joined: Sun Feb 13, 2011 2:14 pm


Return to Help & Support

Who is online

Users browsing this forum: Bing [Bot] and 1 guest

cron