So i'm kinda new to chipmunk and I thought I'd make a little asteroids game. But I have litte problem.
Sometimes the collision detection of my spaceship seems a bit weird or my image is rendered incorrectly. I have no idea. So I was wondering if you guys could help me out
My spaceship consists out of a Poly shape with 3 vector coordinates, being:
Code: Select all
[CP::Vec2.new(10, 0), CP::Vec2.new(-10, -10), CP::Vec2.new(-10, 10)]
Code: Select all
height = 20
width = 20
rimage = Magick::Image.new(width, height) { self.background_color = 'transparent' }
rbrush = Magick::Draw.new
rbrush.stroke('white')
rbrush.line(20, 10, 0, 0)
rbrush.line(20, 10, 0, 20)
rbrush.line(0, 0, 0, 20)
rbrush.draw(rimage)
@image = Gosu::Image.new(screen, rimage, false)
(just to be clear, @shape is the spaceship's poly shape )
Code: Select all
@image.draw_rot(@shape.body.p.x, @shape.body.p.y, 1, @shape.body.a.to_deg)
(to test this I spawn a little ball i can fly into )
Thanks!