GameSalad

Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!

Overlap or collide issue

kajutokajuto Posts: 314Member
edited February 2012 in Miscellaneous
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

Comments

  • FallacyStudiosFallacyStudios Posts: 970Member
    edited February 2012
    @kajuto
    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.
  • kajutokajuto Posts: 314Member
    Can u explain me step by step sorry to bother u I'm new here, what u mean but I dont know what I should put in the constraint and which character I should put it ??
    and <= (less than or equal to), thats what u mean?!
    And 20 is the height or width?!
  • FallacyStudiosFallacyStudios Posts: 970Member
    @kajuto

    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
  • kajutokajuto Posts: 314Member
    Not really so new jaja I mean new just to make sure i understand u correctly.. Explain it to me please I appreaciatte it..

    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
  • FallacyStudiosFallacyStudios Posts: 970Member
    edited February 2012
    @kajuto

    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.
  • kajutokajuto Posts: 314Member
    I will try that in the night after I work here ..
    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
  • FallacyStudiosFallacyStudios Posts: 970Member
    @kajuto

    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.
  • kajutokajuto Posts: 314Member
    Inside the gameplay i have a bad guy, falling object and health bar, and collectable coin (with score of course) emm.....how can i set that every time i enter level 1 the whole scene reset everything to where it's was???? explain me in step please....
  • FallacyStudiosFallacyStudios Posts: 970Member
    Reset Scene Behavior
  • kajutokajuto Posts: 314Member
    u mean, i create a actor called Reset and put it outside the gameplay ? but using the att or what? because i don't want when it touch the reset button restart(reset) the game...
  • FallacyStudiosFallacyStudios Posts: 970Member
    It would need to be inside of a rule
  • kajutokajuto Posts: 314Member
    for example, how u would do it? because i want every time i enter to play that level reset the scene..
This discussion has been closed.