A couple problems.
ArchonStudios
Member, PRO Posts: 23
Hi everyone! I have a couple things that I am looking for some help on, maybe someone here can help me out.
Problem 1:
I have multiple actors spawning at random locations on the screen. The object of the game is to tap these actors to remove them as fast as possible. Sometimes, new actors will spawn over old ones. When I tap an actor that sits on top of another one, they both destroy. How do I prevent the tap from going through both actors and only affect the top most actor?
Problem 2:
Looking for some instruction on how to create a slingshot like effect such as in angry birds. I have been able to replicate the "cannon" effect and shoot a ball out at an angle with a velocity dependent on the distance of the touch from the cannon. However, I have been unable to replicate the effect of touching and dragging backwards, and having the ball get thrown like it is getting flung from the slingshot.
Any help would be greatly appreciated. Please do not point me to any templates that I have to pay for, I have already considered purchasing some and when I have the opportunity to, I will. For now, I am interested in maybe getting a walk-through or some sort of push in the right direction. I have tried and tried (especially with the slingshot), and have not yet been able to figure it out.
Problem 1:
I have multiple actors spawning at random locations on the screen. The object of the game is to tap these actors to remove them as fast as possible. Sometimes, new actors will spawn over old ones. When I tap an actor that sits on top of another one, they both destroy. How do I prevent the tap from going through both actors and only affect the top most actor?
Problem 2:
Looking for some instruction on how to create a slingshot like effect such as in angry birds. I have been able to replicate the "cannon" effect and shoot a ball out at an angle with a velocity dependent on the distance of the touch from the cannon. However, I have been unable to replicate the effect of touching and dragging backwards, and having the ball get thrown like it is getting flung from the slingshot.
Any help would be greatly appreciated. Please do not point me to any templates that I have to pay for, I have already considered purchasing some and when I have the opportunity to, I will. For now, I am interested in maybe getting a walk-through or some sort of push in the right direction. I have tried and tried (especially with the slingshot), and have not yet been able to figure it out.
Comments
For your second question. You need to use an expression to convert the number positive I believe the floor function might work as it will keep the number whole.
Guru Video Channel | Lost Oasis Games | FRYING BACON STUDIOS
The problem with the first video is that tshirtbooth manually places actors on the screen, unlocks each one, and then changes values within the actors. I will only have a spawner on screen, and then the objects will randomly appear on the screen, so unlocking them to give them different values will not work in this case. The second video is cool and shows a good use of tables, but in this case I do want some overlapping to occur. Any suggestions on how to tap just the object on the top layer and destroy it without going through to any actors underneath?
For the second, I am not quite sure I follow you. Can you give an example of how that would work? What attributes would I need to keep track of in order to get the angle and velocity correct? The way I thought it should work:
1. Constrain slingshot rotation to game.launchAngle
2. Touch and hold slingshot and drag finger back to desired location.
3. On release -
a. set game.launchAngle to -(max(0,min(90,vectorToAngle(self.Position.X - mousePosition.X, self.Position.Y - mousePosition.Y)))
b. set game.launchVelocity to -(vectorToAngle(self.Position.X - mousePosition.X, self.Position.Y - mousePosition.Y))
c. Spawn Actor
4. Actor should have change velocity to game.launchVelocity
Am I close? What am I doing wrong?
Guru Video Channel | Lost Oasis Games | FRYING BACON STUDIOS