How do I…
There are two things I’m trying to do:
- When the player gets to a certain score, the falling speed of the object starts to vary.
- When the player also gets to a certain score, a new object starts falling from the score at a high speed to make it easier for the player to get a game over.
What is the expected result
The above pic shows the game spawning the object every 1 second after three seconds have elapsed.
This pic shows me trying to implement the varying speed in the first event, and the game spawning a new object in the second event and the sub-event below, similar to how I made the game spawn the object based on the code in the 1st pic.
What is the actual result
None of the changes I made to the code has any impact when I play the game. Can you guys help me figure out how to solve the problems I am having with my game?
What about something like this?
if mod(Variable(score),500) = 0
change animation of <object> to Variable(animationNum)
change falling speed to <random>
if mod(Variable(score),1000) = 0
create <object> at <random>
Every interval of 500 points a different animation will be played and the object’s falling speed will change. Every interval of 1000 points a new object will be created at a random position.
This is what I specifically want the game to do:
Round start: Object #1 is created once per second.
Score = 500: Object #1 is created once per second, but the falling speed now varies.
Score = 1000: Object #2 is created once per 5 seconds.
Score = 1500: Object #1 is created every 0.5 seconds with varying falling speed. Object #2 is still created every 5 seconds.
Score = 2000: Same as above, but object #2 is now created every 2.5 seconds.
Note: The score = (insert number here) is going to be different in the final version of the game.
Bumping the thread to give an update on the situation. I managed to figure out how to make object #2 spawn when a player reaches a specific score. Here’s how I did it:
I added a second timer (BadBiscuitTimer) underneath the first timer.
I then used a similar code that would spawn the regular biscuits every second for the bad biscuits, except they spawn every 5 seconds.
However, the one problem I’m still having problem with is randomizing the falling speed of the regular biscuit when the player reaches a specific score. The code I used above has no effect on the biscuit’s falling speed. I then changed the falling speed of Biscuit to a single integer, but that does not have any effect, either.
What should I do to properly randomize the falling speed of the objects when the player reaches a certain score?
Instead of changing the current falling speed, change the max falling speed. This will lead to the desired effect.
Ah, thanks! That did the trick. Also, I think I have an idea on how to “randomize” the falling speed of the same object. According to Emeral’s “I Made the Same Game in 8 Engines” video on Youtube, he had two objects labeled “WoodCrate” and “WoodCrate1.” I think WoodCrate had the object fall very slowly, while WoodCrate1 object fell at a slightly faster speed. I think I’ll use Emeral’s idea to make it looks like the objects are falling at different speeds.
Edit: My plan worked, but I made the game harder than it should be. I’ll have to sort that out tomorrow.