Minor Help Needed
michaelleefisherjr
Member Posts: 3
Hello. I already have the majority of my game done, and I really don't need someone to do the rest for me, but I am having some trouble with the code. The main character is a pirate. I want him to attack. I need to know how to set up 4 boxes (A,B,C,D) in a square. The pirate will randomly swing at one of the 4 boxes, and you need to touch it before the animation completes to stay alive. I also want this to gradually speed up. I would think that would be very simple to set up and I would very much appreciate it if someone could explain how to do it down below! Thank you very much for reading this.
Michael
Comments
Hi @michaelleefisherjr, welcome to the forums.
First tip, be as specific as you can with the title of your thread. That way a member can easily see what it is about and pick it up if they think they can help. If the title is vague it will probably be skimmed over.
Secondly, the description of your problem is clear (which is a good start), but some crucial details vital to giving suggestions are missing.
How does the pirate choose a box to swing at? Does he move around? How do you detect the attack? What
Maybe a sketch of your problem will help. Without more detail there could be dozens of solutions, some of which may not even apply to your situation.
MESSAGING, X-PLATFORM LEADERBOARDS, OFFLINE-TIMER, ANALYTICS and BACK-END CONTROL for your GameSalad projects
www.APPFORMATIVE.com
Thanks for the response. I would like it ot be random for which box the pirate chooses, and no he does not move. His body is a static part of the background, but the arms will be added to show the animation.
Scary image
When you touch the boxes, do they destroy or do you protect them during the attack by touching them?
MESSAGING, X-PLATFORM LEADERBOARDS, OFFLINE-TIMER, ANALYTICS and BACK-END CONTROL for your GameSalad projects
www.APPFORMATIVE.com
My vision for it is that the boxes be invisible. They are just four attack points at which he can attack you. So if he begins to swing at you (one of the four places he can), you tap that area (the box) to protect yourself.
Ok, now we are getting the picture.
So, make a self attribute (maybe call it isTouched) in the box. Make rules which set self.isTouched to 1 if touch is pressed, and setting self.isTouched to 0 if touch is released.
Then you can have a rule checking if the hand/attack overlaps with the box and self.isTouched=1, that means you blocked.
And another rule checking if the hand/attack overlaps with the box but self.isTouched=0, that means you did not block.
MESSAGING, X-PLATFORM LEADERBOARDS, OFFLINE-TIMER, ANALYTICS and BACK-END CONTROL for your GameSalad projects
www.APPFORMATIVE.com
This is exactly what I'm looking for. Thank you very much!