Overlap or collide issue
kajuto
Member Posts: 314
Hi everyone .!
When the character (ex Mario) jump on TOP of the bad guys it kill the bad guys when the character collide in front of the bad guys -1 let say for example how can I do that? Because my character collide or jump on top of the bad guys it still -1 either way... Help please I appreciate it
When the character (ex Mario) jump on TOP of the bad guys it kill the bad guys when the character collide in front of the bad guys -1 let say for example how can I do that? Because my character collide or jump on top of the bad guys it still -1 either way... Help please I appreciate it
Comments
Well if you are trying to get a Mario jump squishing an enemy I believe this is how you would do it. Although I haven't tested it yet, but it is worth a shot.
Have 2 global actors for Mario's X and Y. Have it constrained to Mario's X and Y.
Then inside of your enemy actor have a Rule that says: When Enemy Overlaps/Collides with Mario AND self.positionX <= game.MarioX+20 AND self.positionX >= game.MarioX-20 AND game.MarioY = self.positionY+20
Those "20's" used are all under the assumption that the enemy actor is 40x40. So you would adjust from there.
and <= (less than or equal to), thats what u mean?!
And 20 is the height or width?!
If you are pretty new here (and to coding) my explanation may just confuse you more because I don't know the specifics of the sizes of your characters and such. If you want you can email me the file in a zip, I'll take a look at it and see if I can get it working correctly. That way when I send it back over I can explain what I did and you can understand it better.
Just tell me in the email which characters are involved, unless they are named something simple like hero and enemy. My email is FallacyStudios [@] gmail.com
Character is 25x50 both the heroe and the bad guy, or do u think u can do what Im asking in a file and zip for me ? I promise I will put your name in the credit because I already have 2 persons that helped me do far
No it's fine I don't need my name in it for credit.
1)Under game attributes, create 2 attributes: Hero X and Hero Y.
2)Inside of your Hero actor:
-Constrain Attribute: game.Hero X to self.positionX
-Constrain Attribute: game.Hero Y to self.positionY
3)Inside of your enemy actor: Create a new Rule that says:
ALL
-When Enemy Overlaps/Collides with Hero
-game.Hero X <= self.positionX+12
-game.Hero X >= self.positionX-12
-game.Hero Y >= self.positionY+20
-game.Hero Y <= self.positionY+30
Then:
-Destroy Actor (or whatever you want to happen here)
The numbers may need to be tweaked around to get exactly what you want. I haven't tested this so I'm not positive but from the looks of it it should.
By the way, do u have any idea how I can do 2 button slide for the volume ?! One for the music and the second for the sound effects
You are asking for a slider that can adjust the volume up and down?
You would have to make a Game Attribute for each Sound and Volume as a real.
You would need to place both your music and sounds as a Play Sound behavior within an actor
Set the Volume of the Play Sound (or Music) behavior to game.Sound or game.Music... whichever one you are working on.
Then just build the slider the way you want. You can do it a number of ways, but the easiest may be something like off the position of the slider. So in the Slider actor constrain the attribute of game.Sound to self.positionY.
Keep in mind the max for the volume in the Play Sound behavior is 1 so depending on how large your slider is you will have to do some math calculations that are done in the constrain attribute so that it doesn't exceed 1 and that the slider is as tall as you want it to be.