Destroy Actor By Dragging
goldspectre
Member Posts: 6
Hi Folks!
I'm working on a game where there are actors constantly moving across the screen. The object is to press on them, which holds them in place, then drag them back and forth for a bit until they disappear, as if your finger was an eraser on a pencil.
The code I currently have in place for the "erasing" is this, which I found in another forum post:
when either of these are true...
game.Mouse.Position.X < game.DisplaySize.Width.X/2
game.Mouse.Position.Y < game.DisplaySize.Width.Y/2
change self.shakes to self.shakes+1
This method works, but is very inconsistent for my purposes - some actors require you to drag them all the way around the screen to be destroyed, whereas others you can kill with a small shake. I'd prefer the latter: ideally, it'd take a minimal amount of effort to destroy the actor, and the challenge is that the game itself gets faster and faster.
Any ideas for a more consistent drag-to-destroy method?
Bonus Question: In this game, some of the actors "come toward" the player (re: grow larger) - and the game ends when one of the actors becomes 300x300 px.
I'm using interpolation for the growth. If the actor remains untouched, the growth is very steady and that's good. When the player holds the actor, it temporarily freezes the growth, which is also good. However, when the player releases the actor, the actor grows quite a bit larger all of a sudden, in accordance to how much time the player held the actor. Is there a way to pause the interpolation, so that when the actor is released, it won't jump in size?
Thanks in advance for your help!
I'm working on a game where there are actors constantly moving across the screen. The object is to press on them, which holds them in place, then drag them back and forth for a bit until they disappear, as if your finger was an eraser on a pencil.
The code I currently have in place for the "erasing" is this, which I found in another forum post:
when either of these are true...
game.Mouse.Position.X < game.DisplaySize.Width.X/2
game.Mouse.Position.Y < game.DisplaySize.Width.Y/2
change self.shakes to self.shakes+1
This method works, but is very inconsistent for my purposes - some actors require you to drag them all the way around the screen to be destroyed, whereas others you can kill with a small shake. I'd prefer the latter: ideally, it'd take a minimal amount of effort to destroy the actor, and the challenge is that the game itself gets faster and faster.
Any ideas for a more consistent drag-to-destroy method?
Bonus Question: In this game, some of the actors "come toward" the player (re: grow larger) - and the game ends when one of the actors becomes 300x300 px.
I'm using interpolation for the growth. If the actor remains untouched, the growth is very steady and that's good. When the player holds the actor, it temporarily freezes the growth, which is also good. However, when the player releases the actor, the actor grows quite a bit larger all of a sudden, in accordance to how much time the player held the actor. Is there a way to pause the interpolation, so that when the actor is released, it won't jump in size?
Thanks in advance for your help!
Comments