Artifact of the week: Stars

Hi there !

This week I have worked with making stars appear when enemies dies with the rest of the programmers in my group. The stars are our collectables that you get extra score from when finishing the game. The way they work is, when the enemy dies, the stars will spawn from the enemy and get velocity/speed during a brief time in a random direction. Since the time and speed are the same for all the stars, it will end up looking like a circle for the most part.

When the player come near the stars, the stars will start moving towards the player. We decided that it should be like this since it is fun to collect thing but we don’t want the player to run all over the place for scattered stars. When the stars reach the player they will get deleted.

Both to check if the player is near enough to move to him and if the star is close enough to the player to be collected are made by overlaps. The first overlap is checked first when the enemy dies and if the player is not close enough for the stars to start move to him they will scatter. If the enemy would be killed when the player is in range to collect the stars they will go to the player directly. Often the stars will start moving to a random position and then those that was moving towards the player will be switching over to the first overlap and chase after the player until it gets into his collect range. It looks cool when the stars gets shot out and then suddenly starts curving themselves to hit the player. There is a slight problem though, when the player is in range to make the stars go to his position right when he kills the enemy they will never go into the else if statement that tells them to scatter. Currently this makes it look like it is just one start heading towards you. We have some more important things that we have to do tomorrow so I think we will leave it like to the beta at least and see if we can delay them somehow so that it looks like you are getting ten stars instead of one. I guess we could just reduce the range for making the stars go to the player so that it wouldn’t matter when it only looked like one star because it would be so close. But then that would mean that we would have to see if that is enough range so that it does not become like chasing the stars.

Now i will barage you with very precise screenshots about the behavior of the stars with paint drawings 😛 (and the update function from star)

prestars blogg

round stars blogg

stars into range

first 1 star pre travel

first travel 1 star

last blogg star   

bandicam 2014-03-13 03-08-58-058

That’s all for now, thank you for reading and have a nice day/evening/night.

See you in class

/Hampus Lyman

One thought on “Artifact of the week: Stars”

  1. Hi Hampus!
    I have to say, I find your blogpost to be very clear and structured. I like how you express the things to talk about in images. Though, you could skip the last image. The code is not visible at all.

    I saw that you typed a / between velocity and speed. This is kind of true that speed equals velocity but not in this situation. Actually, the velocity equals speed * direction, where direction is a normalized vector.

    You have clearly described how you did this and what you have done but I think you missed to tell us Why you did those things.

    If you posted code, I could tell you what was wrong in your logic when the player is nearby spawning stars. What you have to do is to seperate the velocitys that moves the stars.
    I think you also could split the text in part so that it wont be such a wall-of-text. I also want you to put a comment on each picture, telling exactly what the picture describes.
    Also it would be nice to have an upgrade so that your starsuction radius will be increased. I do not know how the stars works right now, but for each star you pickup there should be a sound and maybe a small particle effect.

Leave a comment