problem with spawn/recycling character back to position
okay so I'm starting to kinda get the hang of the whole recycling an actor behavior thing-a-ma-jig so let me tell you all what I'm having trouble with... there are six characters that you can choose from in my game... and there are power ups that would "destroy" the character... which works out perfectly fine.. but the problem is that my character is not coming back on the screen
... i know, bummer right... but here are the rules that i have placed... hopefully someone can tell me what I'm doing wrong
if actor overlaps or collides with actor of type "power ups"
Change Attribute self.position.x to 600 (which would be off the screen for my game)
then i have a timer set **after 5 seconds (which is when the power up will be done) change attribute self.position.x to 240 change attribute self.position.y to 320
now you might ask... well, of course its not going to show up because it would be off the screen... but my characters all have gravity attached to them and i want the character to spawn right in the middle of the screen basically looking like the character is flying down from above... can anyone help me with this?

if actor overlaps or collides with actor of type "power ups"
Change Attribute self.position.x to 600 (which would be off the screen for my game)
then i have a timer set **after 5 seconds (which is when the power up will be done) change attribute self.position.x to 240 change attribute self.position.y to 320
now you might ask... well, of course its not going to show up because it would be off the screen... but my characters all have gravity attached to them and i want the character to spawn right in the middle of the screen basically looking like the character is flying down from above... can anyone help me with this?
Answers
on playerActor:
Rule: when
Attribute: game.powerUpActive is false
-changeAttribute: self.Position.X To: whatever is correct onScene X
-changeAttribute: self.Position.Y To: whatever is correct onScene Y
Otherwise:
-changeAttribute: self.Position.X To: whatever is correct offScene X
-changeAttribute: self.Position.Y To: whatever is correct offScene Y
on powerUp: … you want lots of the rules here so player has less to process
add selfAttribute: myTimer … real type
Rule: when
Event: overlaps or collides with actor type: player
-changeAttribute: game.powerUpActive To: true
Rule: when
Event: powerUpActive is true
-changeAttribute: myTimer To: self.Time
-whatever you have happening
Rule: when
Attribute: self.Time ≥ myTimer+5
--changeAttribute: game.powerUpActive To: false
--destroy or recycle this actor … if recycling change myTimer to a large# ex: 1000
I think perhaps the self.myTimer purpose/functionality may be confusing you
what the actual value of that attribute is … the computer knows … we do not have to know!
we just have to remember:
… that the actor's self.Time keeps ticking as long as actor is active (in the scene)
… that we tell the computer to compare the self.Time to the value it has placed in myTimer
... and that self.Time will ≥ self.myTimer+5 … after 5 seconds
I try to use the default attributes to control things in my projects … as they are already in Computer memory … and changes in their values require less resources than new behaviors or attributes.
keep laughing @digitalzero … games are fun and making games is fun …
and we all do some funny dumb things!
when attribute self.time =self.mytime+0.2
change attribute game.score to game.score+1
NOTTT! yeah i thought i was being smart but making that but apparently I'm not lol... so is there anyways that i can do this without using the timer?... because of course i would love to use the timer because its the easiest thing to do and i know it works lol but my games are going to become more and more complicated as i go along with working with game salad which has been true lol but my next game i would like to make would be a platform game and of course i wouldn't like for the game to run at 30fps... yeah... that would suck. but right now I'm at 57 fps which is not too bad... but i would like for all of the games to work at 60fps
remember: self.Time is always self.Time … never more or less
… nothing you code will affect it
when scene is loaded … every actor's instance has self.Time = 0 and immediately starts ticking
when you spawn an actor in scene … the spawned actor's self.Time = 0
(and that gives you possibility on spawnedActors
for Ex: Rule: when self.Time ≥ 1 … add some behaviors)
(when referencing self.Time remember that it ticks in real time in milliseconds units
… use ≥ not = … time only equals a specified # for 1 millisecond)
Timers can be quirky with the Every option
also, often on Actors with lots of rules/behaviors
sometimes best to add a controlActor to scene
and have that controlActor for Timers
demo: http://www.mediafire.com/?wji5b2jhgpzxd33
thanks so much for everything @motherhoose!
I don't do videos … I watch all videos … especially @Tshirtbooth's and GS ones.
we all started with GS as newbies …
we learned by watching videos … reading the forum … and exploring the demos/templates
… and playing around with every wonderful feature of GS!
more importantly … we all continue to learn! and enjoy ourselves!
@};- MH