0

I think my issue has something to do with deep vs. shallow cloning, which I have not really worked with before, and cannot seem to understand by reading articles(You can tell I'm not a professional programmer). This is a small game I am making and when I shoot a bullet, I rotate it as much as the velocity vector it is traveling in. This works fine, and the bullets rotate, but they all rotate together, and not independently. I'm unsure how they can each have their own rotation. If someone can point me in the right direction, I'd really appreciate it.

Source: https://github.com/Vynlar/Point-and-Click-Shooter

Thanks, Vynlar

mad_manny
  • 1,081
  • 16
  • 28
Vynlar
  • 55
  • 1
  • 7

1 Answers1

0

Since you are using the resource manager, transforms performed on the image will always remain for that update cycle. You have to transform, draw, then draw the next item, then do the update cycle.

Rotating one image under another one

Community
  • 1
  • 1
FlavorScape
  • 13,301
  • 12
  • 75
  • 117
  • So I need to transform (rotate the image) then draw the image, then draw what next item? The next bullet in the loop? – Vynlar Jul 02 '12 at 23:51
  • I think so. As long as it is a shared resource, the transform effects the resource. So, if you update all at once, then draw, it will only show the last transform. So, transform/draw each bullet, THEN do the next cycle. – FlavorScape Jul 03 '12 at 00:18
  • Oh. That phrasing makes more sense. I understand now. I'll let you know if I can get it to work. – Vynlar Jul 03 '12 at 00:21
  • I had to do some funny things, like updating in the render function for all the bullets, but I got them to face the right way. Thanks for the help. – Vynlar Jul 03 '12 at 00:25
  • I think if you make them unique in memory, that is load a new bitmap/graphics object for each bullet, you don't have to do this, at the cost of slightly more memory getting used. – FlavorScape Jul 03 '12 at 00:32
  • The ResourceManager stops you from doing that, if you get the same image image twice, it will use the already loaded one the second time. The way I have it will work, but I feel like there should be a happy medium. – Vynlar Jul 03 '12 at 01:03