Destroy and Respawn Timer Question
Sylvannus
Member Posts: 21
Hello,
I would like to ask you how exactly I can make this combination: When Player collides or overlaps with Ground Tile, the ground tile destroys itself after 2 seconds and then 3 seconds after destroying to respawn itself on the same spot.
However, I got an idea how to do that exactly but I want you to assess its effectiveness.
-------
Create integer {Jump} set to 1
BEHAVIOURS OF PLAYER
[Rule]
If Player collides or overlaps with Ground Tile - Change Attribute {Jump} to 0
BEHAVIOURS OF GROUND TILE
[Group] (I haven't used the Group option yet but I think I know what is it for)
-[Rule]
When {Jump} is 0
--[Timer]
After 2 seconds
Destroy Ground Tile
[End Group]
[Group]
-[Rule]
When {Jump} is 0
--[Timer]
After 5 seconds
Change Attribute {Jump} to 1
[End Group]
[Rule]
When {Jump} is 1
Spawn Actor - Ground
(((Either destroy or change image to No Image so it wont be any obstacle)))
------
-Are those behaviours correctly created?
------
One more
Q: if constructed that way should I apply those behaviours to EACH ground tile(instance) within the game?Otherwise if it is set to (prototype) it will spawn ground tile on top of other ground tile every 5 seconds.
OR
Is the best solution not to use Spawn Actor behaviour but Change Image behaviour?
----
Sorry for the long thread but I want your opinion.
Rate this 'engine' or suggest one.
Thank you
I would like to ask you how exactly I can make this combination: When Player collides or overlaps with Ground Tile, the ground tile destroys itself after 2 seconds and then 3 seconds after destroying to respawn itself on the same spot.
However, I got an idea how to do that exactly but I want you to assess its effectiveness.
-------
Create integer {Jump} set to 1
BEHAVIOURS OF PLAYER
[Rule]
If Player collides or overlaps with Ground Tile - Change Attribute {Jump} to 0
BEHAVIOURS OF GROUND TILE
[Group] (I haven't used the Group option yet but I think I know what is it for)
-[Rule]
When {Jump} is 0
--[Timer]
After 2 seconds
Destroy Ground Tile
[End Group]
[Group]
-[Rule]
When {Jump} is 0
--[Timer]
After 5 seconds
Change Attribute {Jump} to 1
[End Group]
[Rule]
When {Jump} is 1
Spawn Actor - Ground
(((Either destroy or change image to No Image so it wont be any obstacle)))
------
-Are those behaviours correctly created?
------
One more
Q: if constructed that way should I apply those behaviours to EACH ground tile(instance) within the game?Otherwise if it is set to (prototype) it will spawn ground tile on top of other ground tile every 5 seconds.
OR
Is the best solution not to use Spawn Actor behaviour but Change Image behaviour?
----
Sorry for the long thread but I want your opinion.
Rate this 'engine' or suggest one.
Thank you
Comments
FYI about groups, It really doesn't change how the code works, but rather helps you to organize your code to make it more readable.
When collides or overlaps with actor of type (Whatever)
-- Change Attribute: self.savedPosition To: self.Position.X
-- Timer -- After 2 Seconds
---- Change Attribute: self.Position.X To: -200
-- Timer -- After 5 Seconds
---- Change Attribute: self.Position.X To: self.savedPosition
Note: better check "run to completion" on each timer.