Get an expression work after typing it in
Creator97
Member Posts: 140
First of all I want to know if there's a solution for this:
Is there no way to save an expression which is related to current scene. Because that I have to edit each time I drag the actor into the scene.
The workaround for me was to make a note under the behavior and let the expression gap blank and then I did just copy and pasted the note in the gap after adding the actor into the scene, BUT it does not work, because there's no blue circle under the expression.
So how do I get this circle under my typed (and not chosen out of the drop down menu) expression to let it work?
Answers
I don't mean to be offensive but is English your first language? I'm having a hard time understanding what you wrote.
By blue circle, I assume you mean the highlighted oval that appears when you've selected an attribute from the drop-down menu. Attributes and tables must be selected this way; they cannot be typed in. Anything else, such as text, numbers, and mathematical expressions can be typed in directly.
And which scene attributes are you needing to access? Camera position? Something else?
New to GameSalad? (FAQs) | Tutorials | Templates | Greenleaf Games | Educator & Certified GameSalad User
No I am german. (Is it that bad?)
And it's this one: scene.Background.Blue Player.Position.X
So I really have to make a note and then choose everything again from the drop down menu. That's really the only way to do it? (Or let's say the best way to do it?!)
It's not bad at all. I just figured that if I wasn't understanding you well something was "lost in translation."
If you need to access another actor's position attributes, you might instead constrain game.bluePlayerX to self.position.X in the blue player actor (and the same for the Y position). Then every other actor in any scene can access those game attributes.
New to GameSalad? (FAQs) | Tutorials | Templates | Greenleaf Games | Educator & Certified GameSalad User
That what you mentioned (game.bluePlayerX) cannot be chosen from the drop down menu so that's something you have to know to type it in I guess. So I did that for the blue Player and then I reentered the Blue Player and GS automatically changed the game.bluePlayerX gap to self.Position.X so there's self.Position.X to self.Position.X as a constrain attribute which seams pretty dumb to me. Then I went back in the the actor that should follow and chose again self.Position.X to scene.Background.Blue Player.Position.X but it says Warning: invalid attribute values: Constrain attribute. And it's the same when I save it under Custom Behaviors and then add it in the actor, when I added it in the scene.
So now I am at the point I was a few days before.
Please help me Chef!
Based on the file you sent me, the problem is that you are constraining the red actor's self.Position.X to its self.position.X. That just keeps the actor in the same place. You have to use a game attribute for actors to communicate with each other.
Here's how it should be set up.
New to GameSalad? (FAQs) | Tutorials | Templates | Greenleaf Games | Educator & Certified GameSalad User
Ok I see, It works but what you did isn't possible without creating several attributes, right? I mean you would have so many attributes because in my game there are so many behaviors they do just that. Do you think the app will break, when so many actor's will constrain to positions all at one time when the scene starts, lets say 100? I use them as colliders to have not just rectangles and circles, you know! Under Game Attributes you can find Display Size as an Drop down menu. Is there a way to self create those "folders"
100 constrained actors is WAY too many.
You might try my enemy health bar demo... it uses tables to keep two actors synced with each other:
http://forums.gamesalad.com/discussion/comment/384027/#Comment_384027
New to GameSalad? (FAQs) | Tutorials | Templates | Greenleaf Games | Educator & Certified GameSalad User
Under Game Attributes you can find Display Size as an Drop down menu. Is there a way to self create those "folders".
I meant they constrain to actor's that don't move just one time is then 100 too many?
No.
I don't understand what you mean.
New to GameSalad? (FAQs) | Tutorials | Templates | Greenleaf Games | Educator & Certified GameSalad User
I thought you understood that I have moving actor's and 100 other actor's have to constrain all the time to the position of the moving characters.
But what I meant is that I have actor's (not moving) and 100 other actor's have to constrain once (at the start of the scene) to the position of the actor's. Is then 100 too many?
If you have actors that are not moving, you do not need to use a Constrain behavior. Instead, just change the attribute of one actor's self.Position.X and Y to the other actor's game attributes:
Stationary actor:
Change Attribute game.actor1X to self.position.X
Change Attribute game.actor1Y to self.position.Y
Following actor:
Timer after 0.1 seconds
Change Attribute self.position.X to game.actor1X
Change Attribute self.position.Y to game.actor1Y
The timer is there because you want to make sure the "following" actor sets its position after the "stationary actor" changes the values of the game attributes.
You can make as many change attribute statements as you like without really affecting gameplay much. But again, with 100 actors there is no way I would ever use attributes. I would use a table (see my enemy health bar demos).
New to GameSalad? (FAQs) | Tutorials | Templates | Greenleaf Games | Educator & Certified GameSalad User
Yeah I never really used a table (I looked at your health bar demo) and I found it complicated (I am a beginner so I really didn't get it.) I will go to bed now. Tomorrow I will rethink everything.
Using tables is not difficult but I understand that it can be intimidating for some people when they first start using GameSalad. That being said, my demo is pretty complex so I don't recommend it unless you have a solid understanding of GameSalad in general and also are comfortable using tables. You might start with some of the tables and logic tutorials that are out there by people like @Braydon_SFX and @The_Gamesalad_Guru and then come back to this idea of 100 constrained actors later.
New to GameSalad? (FAQs) | Tutorials | Templates | Greenleaf Games | Educator & Certified GameSalad User