GameSalad seeming bug. Can someone explain this to me?
EarthSpirit
Member, PRO Posts: 7
Hi everyone. I've been working on a project using GameSalad and have enjoyed the process. I just wanted to mention here what I think is a bug. I simplified and tested the problem in a new project. Tell me if my logic is incorrect in anyway..
I have a simple Rule with 2 conditions. self.Bla should equal 0 and self.Position.X < 300. When the rule fires I change self.Bla to 1 so the loop doesn't fire anymore. However when testing I find that when self.Position.X goes above 300 and then below again the rule fires again. So why is this happening. Its not supposed too right? When I place self.Bla = 1 outside of the rule it only fires once like its supposed too.
I created a very simple actor to illustrate my point. Here's an image. In the image are 3 simple rules. the one above. Left key pressed and right key pressed (which moves the actor right and left : ) ).
http://postimg.org/image/fiqoba2hx/
So why is this firing more then once. It fires everytime position moves above and below 300. I change the attribute self.bla no where else in this simple project. Is this a bug in GameSalad. I'd like to know so I can prevent doing coding like this in my other projects. Hopefully someone knows. Thanks
I have a simple Rule with 2 conditions. self.Bla should equal 0 and self.Position.X < 300. When the rule fires I change self.Bla to 1 so the loop doesn't fire anymore. However when testing I find that when self.Position.X goes above 300 and then below again the rule fires again. So why is this happening. Its not supposed too right? When I place self.Bla = 1 outside of the rule it only fires once like its supposed too.
I created a very simple actor to illustrate my point. Here's an image. In the image are 3 simple rules. the one above. Left key pressed and right key pressed (which moves the actor right and left : ) ).
http://postimg.org/image/fiqoba2hx/
So why is this firing more then once. It fires everytime position moves above and below 300. I change the attribute self.bla no where else in this simple project. Is this a bug in GameSalad. I'd like to know so I can prevent doing coding like this in my other projects. Hopefully someone knows. Thanks
Comments
The first is remove the self.bla=0 attribute from the first rule and test
Or add a change attribute in the otherwise self.bla=0
Those both should work but I recommend the first one. I'm not in front of my computer to test. But that should do the trick.
Hello @EarthSpirit just to mention, you don't have to put 0.0 into an attribute - an integer or even a real one - 0 will do just fine.
So if I understand what you're after from your description, try amending your Rules to:
Rule: When self.Bla =0
Rule: --- nested in above-- When self.Position.X < 300
Change Attribute self.Bla to 1
That'll only happen once, and won't happen again until Bla is zero again and self pos. is below 300 again.
Edit: @mounted 88 beat me to it again!... posting while I was typing. :-)
""You are in a maze of twisty passages, all alike." - Zork temp domain http://spidergriffin.wix.com/alphaghostapps
Hey @mounted88, no apology necessary! It's great you like to help people when you can (ditto :-) ) and it's good you're "quick off the draw" too! B-)
""You are in a maze of twisty passages, all alike." - Zork temp domain http://spidergriffin.wix.com/alphaghostapps
create att name it fire
at player actor rule this
key (or whatever you want, touch mouse pressed vs) is down
attribute fire=0
do
spawn actor bullet
change attribute fire to 1
put another rule on bullet
timer 2 sec
destroy this actor
change attribute fire to 0
Follow us: Twitter - Website
I realize in debugging i wrote "This loop is hit". I ment "This Rule is hit" lol.
The video is available on higher quality if you view it directly on youtube.