How to make a rule the says...
ofekez
Member, PRO Posts: 95
Hey,
I would like to know how to make a rule the says "If (x) is greater and lower the (y) so..."?
BR,
Ofek.
Comments
What does "greater and lower the" mean? If you meant to write "greater and lower than," how can an attribute be both greater and lower than a number?
Can you give an example of the range of x and y values you're wanting? You can choose =, ≠, ≤, <, >, or ≥ as part of the rule condition for integer or real attributes.
Are x and y self.Position.X and Y or something else? Are either of those attributes that you created?
New to GameSalad? (FAQs) | Tutorials | Templates | Greenleaf Games | Educator & Certified GameSalad User
You just did it! LOL
In the rule use the drop down menu to choose "not equal to". It looks like an equal sign with a slash through it ( ≠ ).
If X is not equal to Y then it is either greater than or less than Y.
http://jamie-cross.net/posts/ ✮ Udemy: Introduction to Mobile Games Development ✮ Learn Mobile Game Development in One Day Using Gamesalad ✮ My Patreon Page
This is an image that shows what i want to do but from some reason this rule doesn't work...
If those are two conditions in the same rule, make sure the rule is set to ALL conditions rather than ANY. How do you know it's not working? Are you using a Display Text behavior to watch the value of game.jump top? If so, what are the values you're seeing? Is game.jump top an Integer or Real attribute?
New to GameSalad? (FAQs) | Tutorials | Templates | Greenleaf Games | Educator & Certified GameSalad User
game.jump is an integer.
The rule is set to "ALL".
From some reason even when game.jump is set to -1 the rule is still working.
There is the project file, i'll be thankful if you will see what you can do about it,
This rule is in the actor called "ScoreTOPtext".
http://www.mediafire.com/download/k9e8m3o69bvtque/jump_chump_clone.rar
I don't see an actor with that name. Can you double-check the name and also tell me which scene that actor is on?
New to GameSalad? (FAQs) | Tutorials | Templates | Greenleaf Games | Educator & Certified GameSalad User
Hey, The actor's name is: "ScoreTOPtext" and he is in the Initial Scene
I put a Log Debugging Statement in that rule and it does in fact trigger. Something to keep in mind is that a rule only triggers when its condition changes from false to true. I noticed that game.jump top toggles between 0 and 1 most of the time. In that case, the rule will trigger when the value is between 0 and 2 but it won't trigger again unless the value first becomes NOT between 0 and 2.
To give a simple example, the rule If game.Time>0 will trigger when game.Time is 0.1 but won't keep triggering as game.Time increases. It will only trigger once.
New to GameSalad? (FAQs) | Tutorials | Templates | Greenleaf Games | Educator & Certified GameSalad User
But the game.jump top is set to -1 so why the timer is still working even though it supposed to work only when game.jump top is 0 or 1?
Edit: and another thing, if you can see on the actor called: spawner top (in the Initial Scene) so it says that only if game.jump top is lower then 2 so it should work but i checked it and even when the game.jump top is 2 the rule is still working. I don't get it.
Hey,
I would like to know how to make an attribute the says " if (x) equals (y) or (z) then..."?
BR,
Ofek.
Create a rule,
If any
attribute.x = attribute.y
attribute.x = attribute.z
then
whatever here
Fortuna Infortuna Forti Una
[merged]
New to GameSalad? (FAQs) | Tutorials | Templates | Greenleaf Games | Educator & Certified GameSalad User
Something else is changing game.jump top to 0 or 1. Rules don't mysteriously trigger so you'll have to find the actor that is changing that attribute's value. One not very efficient way to find it is to delete actors one by one from the scene until it's fixed. The last actor you deleted is either entirely responsible or partly responsible.
Well, that rule will trigger immediately since game.jump top starts out at -1.
New to GameSalad? (FAQs) | Tutorials | Templates | Greenleaf Games | Educator & Certified GameSalad User
I did it and it is still doesn't work.
game.jump top top is set to -1 in his default and in the rule it says:
When Any
if game.jump top = 1
if game.jumo top = 0
The problem is that when i hit play the rule is working even though game.jump top is -1
As stated before, there has to be something else triggering it, rules just don't mysteriously fire.
Fortuna Infortuna Forti Una
Ok thank you, i'll try to see what is it...
I'm sorry for all of those questions but i have another question and i hope this one will be the last. I made a rule that says: "if touch is pressed change scene to (scene's name)" but when i click this specific actor, nothing is happening.
Hmm that is pretty straight forward. Are you unlocking your actor at the instance by any chance?
Fortuna Infortuna Forti Una
Yes, that's because i'm using at the same actors for few scenes and i want each one to have another type of actions to do.
It can make the whole project very confusing when actors are unlocked, just make sure the actual actor in the instance has the rules that you need.
Fortuna Infortuna Forti Una
I checked on the normal version of Gamesalad and it is just fine, for some reason in the Nightly version there's a problem. Anything i can do about that?
Just have to wait it out until a new stable comes out for windows. Probably by the end of the month or early next month.
Fortuna Infortuna Forti Una