Welcome, Guest. Please login or register. Did you miss your activation email?

Show Posts

This section allows you to view all posts made by this member. Note that you can only see posts made in areas you currently have access to.


Messages - Sinclaire

Pages: [1]
1
General / Implementing the Projectiles in a Sidescroller Game
« on: January 23, 2016, 11:36:44 pm »
Hey!

I am currently trying to wrap my head around creating a small Sidescrolling Shooter.
What I can't figure out is what code to use for the shots/projectiles. The goal is obviously to despawn a projectile once it hit a target, so I figured I have to get the bounding boxes of every enemy on the screen and every projectile and test the collision through intersects.
The next step is to despawn the projectile.
So overall, I thought of using a list or vector to contain all of the possibly shot projectiles and maybe allocating additional memory if somehow more projectiles than expected are on the screen at the same time. But despawning the projectiles really gives me trouble, since with a vect I would constantly be erasing elements right in the middle of it, resulting in horrible performance drops (I suppose).
I've been trying to find source codes of other sidescroller games to compare the ideas but tough luck.  :P ???

So yeah, if there happens to be a super-efficient way of implementing shots, please tell me  :)

2
Graphics / Question on Animation Handling
« on: January 18, 2016, 12:32:40 am »
Hello!  :DI have a Question regarding using Sprites for animation. I have heard that libraries such as Thor have good Animation handling and if you tell me it would be best to use it, I will do so. However, because I want to learn, I dont want to simply go down the easiest path. So I hope you can answer me this.

Let's say I want to make a charakter walk to the right and having his Sprite change accordingly to make an animation of the character walking. The way I see it there are three methods to achieve this:


1st Method: Have lots of differend Images (e.g. Character1.png, Character2.png,....) and Change the Sprite of the character continuously from the beginning image to the ending image and repeat.


2nd Method:
Have one huge Image that contains all of the Characters poses needed for the animation and just have his sprite be a small rectangle that envelops one of these poses. So all you need to change for the animation is the position of the rectangle while the image/texture can stay the same. This sounds a lot smarter than the first version.


3rd Method:
Have many different images like in Method 1, but also create many sprites ready. Each of the Sprites contains one Image of the Characters Walking Process, So you simply have to tell the Gamewindow to draw a different Sprite each Time.


I hope to have managed to explain clearly what I mean, because I fear it's not very understandable. So the tl.dr is:
1) One Sprite, many Images. Keep loading different Images as Texture into the one sprite.
2) One Sprite, one Image. Just change the position of the rectangle and thus change how the sprite looks.
3) Many Sprites, each with their own image/texture. Display a different sprite each time.


Instinctively, it sounds like Method 2 is the smartest by far, because it doesnt need too much space for all the Sprites or computation time for reloading Images. But I would be really glad over a definite answer.

Cheers, Sinclaire  :)

Pages: [1]
anything