Changing speed of the game and change background
butterbean
Member Posts: 4,315
How would someone propose doing this:
Speeding up the game, such as making the enemies spawn more in number, and travel faster each time a player reaches a certain point in their score, say every 2,000 points: Enemies speed up, and game moves faster
Also, can you change the background, or add animations/images everytime the score increments by 2,000 or whatever score desired?
Thanks!
Speeding up the game, such as making the enemies spawn more in number, and travel faster each time a player reaches a certain point in their score, say every 2,000 points: Enemies speed up, and game moves faster
Also, can you change the background, or add animations/images everytime the score increments by 2,000 or whatever score desired?
Thanks!
Comments
Obviously you have a 'score' attribute
Then you'd have to create a rule that said
if attribute score = 2000, change the value of speed to = 2
if attribute score = 4000, change the value of speed to = 4
etc etc
Every time an actor that gives points is destroyed, then instead of just saying:
Change attribute score to score +100
You'd have:
Change attribute score to score+100*speed
That way, if you're just starting out you'd get 100 points for each actor destroyed to begin with, as speed = 0
However, as soon as you hit 2000 points, speed =2. So you'd get 100*2 = 200
Then if you hit 4000 points, you'd get 100*4=400
And so on and so on...
Hope that helps,
QS
Dr. Sam Beckett never returned home...
Twitter: https://twitter.com/Quantum_Sheep
Web: https://quantumsheep.itch.io
So when first starting out the game, under the enemy prototype, destroy behavior, I currently have change game.score to game.score +100
So instead of plugging that in, you're saying to plug in under enemy prototype, destroy behavior, change attribute :
game.score to game.score+100*0 (0 meaning speed)
Then create a Rule:
When game.score = 2,000 points
How would I plug in the score and speed with the menus again?
Game.Score to Game.score +100*2 (for speed 2?)
Are there any other elements I would need to plug in to tell the enemies how MUCH faster to move besides creating a global game attribute, speed?
Thanks Quantum~!
"So when first starting out the game, under the enemy prototype, destroy behavior, I currently have change game.score to game.score +100
So instead of plugging that in, you're saying to plug in under enemy prototype, destroy behavior, change attribute :
game.score to game.score+100*0 (0 meaning speed)"
CORRECT - THOUGH REPLACE THE 0 WITH THE SPEED VARIABLE.
"Then create a Rule:
When game.score = 2,000 points
How would I plug in the score and speed with the menus again?
Game.Score to Game.score +100*2 (for speed 2?)"
YEP, THAT SOUNDS FINE
"Are there any other elements I would need to plug in to tell the enemies how MUCH faster to move besides creating a global game attribute, speed?"
Right, enough capitals! For this last bit, I have to admit I didn't fully read your question to begin with, so gave the speed variable as a modifier for just the score.
If you want to make things move faster, you can still use the speed variable.
Say, initially, your enemy actor moves with a velocity of 40. If you make him move with a speed of 40*Speed, then whatever the movement will be is multiplied by the speed variable value.
So, at less than 2000 points as seen in my previous reply, the velocity of your actor will be 40 (40*0)
At 2000 points, it will be 80 (40*2)
If you find your actors are moving too fast, then just add a division at the end.
e.g. 40*Speed/.75
Hope that helps!
QS
Dr. Sam Beckett never returned home...
Twitter: https://twitter.com/Quantum_Sheep
Web: https://quantumsheep.itch.io
One more question! So when initially plugging in my value for the enemy actor's speed or velocity, do I change it to a number, and then asterisk, zero like this: 25*0 (25 velocity, 0=speed)?
That way when I enter subsequent values like 25*2 then the velocity will become 50 right?
Thanks Quantum! I'm gonna give it a try when I'm on GS again
That way when I enter subsequent values like 25*2 then the velocity will become 50 right?"
What you wanna do is 25*game.Speed.
Have your initial speed setting at 1. That way 25*1 = 25.
When you score goes up to whatever you want, you can add + 1 to speed. Then it would automatically change to 25*2.
It changes b/c instead of using a number you're using a global attribute. (Score) So when that changes it automatically updates the equation or you.
See? Told you my maths was rubbish! :P
Dr. Sam Beckett never returned home...
Twitter: https://twitter.com/Quantum_Sheep
Web: https://quantumsheep.itch.io
"40*Speed/.75"
you're actually dividing by 3/4 which is equivalent to multiplying by 4/3 and actually making it go faster.
As an alternative you could do this:
Set the actor speed to this equation: 25*(1+(game.score-game.score%2000)/2000)
Breaking that equation down:
(game.score-game.score%2000) : This will remove any remainder when you divide the score by 2000 so this whole part of the equation is divisible by 2000.
Adding 1 : Before you reach a score of 2000, the equation section above will be 0, so adding 1 will make the first level move at 25.
I just want to thank you Sous Chefs for being so active in helping the forums.
Dr. Sam Beckett never returned home...
Twitter: https://twitter.com/Quantum_Sheep
Web: https://quantumsheep.itch.io
So this equation you gave me.... does this go under the original "enemy move attribute" under speed: 25*(game.score-game.score%2000)/2000 or does this go in the original enemy attribute: 25*(1+game.score-game.score%2000)/2000
And then subsequently, upon score reaching 2000 points, do I put the +1 in the front of game.score in the parentheses? So it looks like this" 25*(1+game.score-game.score%2000)/2000
And under the game.speed global attribute, I set it to integer, and 0 right?
Thanks! the more detailed the better for me, (I know it's a pain in the ass) BUT .... I'm nowhere near your level of coding....
Thanks! You guys are great!
Difference between using Move behavior or a Change Velocity.
If you use Change Velocity, its a one time change and is not a continual use of processor to adjust movement. However its only great when your actor moves in a straight line.
With the Move behavior you can include functions that continually change the speed and direction.
Use the whole equation(including the +1), it takes care of doing the calculation of changing your speed dependent on your score.
Difference between using Move behavior or a Change Velocity.
If you use Change Velocity, its a one time change and is not a continual use of processor to adjust movement. However its only great when your actor moves in a straight line. Also, in the enemy case, only new enemy spawned will be affected by the level change.
With the Move behavior you can include functions that continually change the speed and direction.
Use the whole equation(including the +1), it takes care of doing the calculation of changing your speed dependent on your score.
Speed: 25*(1+game.score-game.score%2000)/2000
The enemies won't move down on the screen like they once did, they just spawn at the top of the Y axis around 320. and stay there in animation
Also, I deleted the global game attribute speed as integer, and just have the global game attribute score as integer
What am I doing wrong?
Also, under create rule: When game score reaches 2000
What do I put for these values? (parentheses are fill in the blank for me
An Attribute changes: ( ) equals : 2000
Change attribute ( ) to ( ) e
Speed: 25*(1+game.score-game.score%2000)/2000
and
25*(1+(game.score-game.score%2000)/2000)
expanding the 2nd function it is:
25+25*(game.score-game.score%2000)/2000 => 25+(game.score-game.score%2000)/80 ...
You don't need a rule to check for when score is equal to 2000. Unless you want to do something between level changes.
Under my enemy prototype, under the move rule, and under speed, I replaced my equation with the correct one, under move, speed: 25* (1+(game.score-game.score%2000)/2000 and the enemies spawn at the top of the y axis, but don't come down like they did, they just stay there in animation
I get the equation, but I need help with where to place it
Create Rule? Change attribute? Or place a new "Move" rule, that's where I need the help
Thanks!
Also, I'm looking for the easiest way to do this, and this equation seems to have made things more complex, if there is an easier alternative way, let me know, otherwise I'll keep trying this until it's right
Although now looking at equation, what is the /80 in the 2nd part.....??
Also, to make sure I understand, using velocity is less memory intensive than using Move? I guess it makes since. Of course, it's more limited, but is nice to know since we could use it more for basic movements.
Butterbean: What do your "actors" do? You said they don't move down like they did before. Did you change the "move to" part of the move? What does the Move to for x/y say?
Also did you make sure to put the " ) " at the end of the equation??
I don't mind creating a rule, when score reaches n=X, then changing the speed that way, my game is pretty simplistic, and could handle a few more attributes and rules
Thanks so much guys!
You're not typing in "game.score" as text, correct? It should be that game attribute.
All the parentheses are closed? i.e. for each '(' you need a ')'
The /80 part was just me cleaning up the function. You can ignore that.
I have my enemy prototype, and right under the enemy actor editor I have the following
Animate (with 3 different pics, and at 8 fps)
Then right under that I have
MOVE: direction 270 relative to : Actor move type: additive
Speed: 25 ------> This is where I plugged in your equation, but the game froze up Speed: 25*(1+(game.score-game.score%2000)/2000 AND yes I did take the game.score from the attribute box, and didn't type it in manually
Under Spawn Blue Crow prototype:
I have Timer every .7 seconds
Spawn actor
Spawn a new: Blue crow Direction 0 relative to actor
Position: Random (0,480) and Y axis: 310 relative to actor
So I am wondering what would be the easiest or alternative way instead of using the equation which seems to have created slowdown, and made the game freeze up, and as brilliant as it is, I just want easy.
Could I add the global game attribute game.speed, as integer, and start at 1
If so, can you please tell me where to plug the values in, and where on the enemy attribute do I do this, that's where the confusion comes in for me.... newbie programmer! AKA: PITA2GS (pain in the ass 2 game salad!)
and the birds are now moving down on the screen, don't ask why it works now, I just started over and now it works
So how do I now up the speed of the birds once the score reaches 2000, and WHERE do I place that attribute? In other words, what behavior will I be placing that in?
Does that mean that each time the score increments by 2000, that the birds will travel faster?
I would like to have the equation so that if I changed my mind, I could make the birds travel faster every 5,000 points
Again, WHERE to place this behavior each time a change is made to the speed of the birds would be awesome
1. Speed: 25*(1+(game.score-game.score%2000)/2000 - This is wrong
Speed: 25*(1+(game.score-game.score%2000)/2000) - this is right. Just want to make sure you're doing this.
2. Basically you would change 2000 to 5000 in the equation, to change how many points are needed. You change it in both places.
3. I lied, 3 things. It should auto update the speed. That's what the equation CodeMonkey gave you is for
- Also, I'm at work, can't use ichat. & my mac is not connected to internet. I hate using routers & my main is a pc.
Thank you for being so patient with me
So by adding this equation, every 2,000 points, the enemies will move faster and faster
If I wanted to change it to every 5000 points, I can just replace that number 2000 with the 5000 correct?
Thanks to JGary, Codemonkey, and Quantum, you deserve a friggin' medal!
Later in the game, as I create more difficulty, is there a way to spawn more characters, or an equation to do so as points go up
I was also thinking alternatively of just doing that under a timer which would be easiest
Thanks again!
Speed: 25*(1+(game.score-game.score%2000)/2000) to double would go to
Speed: 50*(1+(game.score-game.score%2000)/2000)
To double it based on score, with the current equation once score = 4000 it will double to 50. When it is 6000 it would go to 75. etc... (basically add 25 for each 2000)
Want to make it so score would need to be 5000?
Speed: 25*(1+(game.score-game.score%5000)/5000)
Hope this helps.
This is a great and ingenius equation Codemonkey! It should be placed in the Wiki for others to use since this is a commonly used attribute in basic games
Is there a way also to put a rule, that the healthbars can be no more than 3, so in the event that the player touches a health item that increases their health by +1, that it will not allow healthbars to go above 3?
You may use different names, but thats the basic concept.