Forums Archived

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

Basic way to display & manipulate images.

Get help and support with Rubygame

Basic way to display & manipulate images.

Postby Omegas7 » Sat Oct 02, 2010 7:01 pm

Hello! I am new to RubyGame. I do have some little ruby knowledge from the past, and I'm now making my test project.

Currently, this is the way I am displaying my sprites:
Code: Select all
@ship = Surface.load("images/Ship.png")
@ship.blit(@screen, [ 250, 350])


Where @screen equals Screen.open [ 640, 480]

Anyway, I am not sure if my above method is the best or most convenient way to display all my game's sprites.

I am interested in editing many properties: X, Y, Z and alpha for my sprites, but when I looked at the Surface class on the documentation, I couldn't find a way for doing such. Am I even looking in the right place? 0.o

Thanks ~
Omegas7
 
Posts: 1
Joined: Sat Oct 02, 2010 6:52 pm

Re: Basic way to display & manipulate images.

Postby indspenceable » Sun Oct 03, 2010 3:04 pm

Look through the API for Rubygame::Surface. You'll get set_alpha(), and you can also do blit blit( target, pos, src_rect=nil ), which lets you choose where to put a smaller subsection of original image.

So when you do
Code: Select all
@ship.blit(@screen, [ 250, 350])
you are copying the ship sprite to 250,350 (x, y). However, rubygame is a wrapper around SDL which is a 2d display engine. Thus you aren't going to find a lot of stuff for z coords.

Does that help? If not, what specifically are you trying to do?
indspenceable
 
Posts: 8
Joined: Fri Jun 18, 2010 7:47 am


Return to Help & Support

Who is online

Users browsing this forum: No registered users and 1 guest

cron