Problem when colliding with a "custom" rotating actor. Maybe a bug?
MarkOnTheIron
Member Posts: 1,447
I was working on an update for my last game "A Plinky Game!". In one of the levels I made an actor rotate from one end using rules and change behaviors but I got strange to none collision.
It's something wrong with my code or it's a bug? Here's what I did:
The scene has gravity.
On the rotating actor:
Movable set to false
An animate attribute with 4 frames
- Timer
Every 1 second
Change attribute self.myPosition to (self.myPosition+1)%6 <-- That's to get a value between 0 and 5
- Rule
When attribute self.myPosition = 0
Change attribute self.PositionX to 25
Change attribute self.PositionY to 240
Change attribute self.Rotation to 120
- Rule
When attribute self.myPosition = 1
Change attribute self.PositionX to 55
Change attribute self.PositionY to 240
Change attribute self.Rotation to 60
And so on until self.myPosition = 5 and after that the value get back to 0.
On the colliding actor (the ball):
- Rule
When overlap or collide with actor of type Laser
Change attribute self.iamDead to 1
- Rule
When attribute self.iamDead = 1
Destroy this actor
What happens is that with those rules everything apparently works fine and the actor rotate exactly as I meant it to be, however the ball collide only with the invisible "ghost" of the rotating actor that stay fixed on the coordinates relative of the 0 value of myPosition.
I tried to change the rotating actor to movable and using constraint attribute instead of change attribute to avoid it to fall but it seems that the ball collide with a falling invisible "ghost" of the rotating actor.
I don't know if I explained the problem well and I can't post an example now since I'm at work, but if someone has an idea of what is happening his help is welcome.
It's something wrong with my code or it's a bug? Here's what I did:
The scene has gravity.
On the rotating actor:
Movable set to false
An animate attribute with 4 frames
- Timer
Every 1 second
Change attribute self.myPosition to (self.myPosition+1)%6 <-- That's to get a value between 0 and 5
- Rule
When attribute self.myPosition = 0
Change attribute self.PositionX to 25
Change attribute self.PositionY to 240
Change attribute self.Rotation to 120
- Rule
When attribute self.myPosition = 1
Change attribute self.PositionX to 55
Change attribute self.PositionY to 240
Change attribute self.Rotation to 60
And so on until self.myPosition = 5 and after that the value get back to 0.
On the colliding actor (the ball):
- Rule
When overlap or collide with actor of type Laser
Change attribute self.iamDead to 1
- Rule
When attribute self.iamDead = 1
Destroy this actor
What happens is that with those rules everything apparently works fine and the actor rotate exactly as I meant it to be, however the ball collide only with the invisible "ghost" of the rotating actor that stay fixed on the coordinates relative of the 0 value of myPosition.
I tried to change the rotating actor to movable and using constraint attribute instead of change attribute to avoid it to fall but it seems that the ball collide with a falling invisible "ghost" of the rotating actor.
I don't know if I explained the problem well and I can't post an example now since I'm at work, but if someone has an idea of what is happening his help is welcome.
Comments
Sorry the hurry, but if it's not doable I have to redesign some levels.
The problem here is that since GS doesn't allow for end point rotation the only other solution would be to use an actor that is half invisible but it still would collide with the invisible part.
Your problem sounds too in depth for most of us to jump in and quick fix without getting directly involved in your game...it may be one of those things you just have to work through on your own. We all have them. Some problems I have come across can take a whole day to resolve...but I eventually solve them. Don't give up...just look for an alternative to achieve the same results. Simpler is always better.
One thing you might try is isolating rules:
Maybe this thread will help:
http://gamesalad.com/forums/topic.php?id=3913#post-22935
I was trying to replicate with rules an end point rotation (using transparent pixel for the other half would be pointless since it would still collide).
I think this is for sure a bug since I read in another thread another user having similar problems when trying to create a pinball game. I sent a working copy of the issue to GS to see if they can address it in future updates.
Maybe someone has some idea on how can I overcome this problem.