Enemies like in Mario - not destroying actor

huppertatorhuppertator Member Posts: 34
edited June 2012 in Working with GS (Mac)
I have a game sort of like Mario that I'm making. The character is a pirate and the "goomba enemy" is a sand crab. What I'm trying to do is get the pirate to destroy the crab on collision from jumping, and if the pirate just runs into the crab it will destroy the pirate. I have it working where in general the pirate destroys the crab, but if I try and flip it where the pirate just runs into the crab and gets destroyed, the pirate just will not die! I tried killing the pirate by just a mouse click or keyboard press but nothing happens. Anyone know what the deal is?

Best Answer

Answers

  • NmdogdudeNmdogdude Member Posts: 174
    try making separate actors for the sides and the top of the crab.
    for the sides, in the pirate's rules 'when actor collides w/ actor of type side, destroy actor 'pirate', and on the top do the same as above but change it to destroy actor 'crab'.
  • huppertatorhuppertator Member Posts: 34
    Thanks. I got it working pretty much right after I posted this. Now my issue is making the crabs move properly. I set up walls for the crab to collide with. So I have crab-move direction 0 at 200 velocity.Then if the crab collides with Right Wall change attribute self.Motion.LinearVelocity.X = -1 (or 180). It bounces to the left but then it just keeps bouncing against the wall. Should I change it to constrain attribute when it collides with the wall? I have the same thing set up for if the crab collides with a left wall it's direction changes back to 0.
  • NmdogdudeNmdogdude Member Posts: 174
    Try using the interpolate behavior, or just have it when actor 'crab' collides w/ actor 'wall', change attribute self.motion.linearvelocity.x to -self.motion.linearvelocity.x, that should create an inverse motion until the crab collides with another wall.
  • huppertatorhuppertator Member Posts: 34
    I didn't know that was an option to just make it negative. I tried interpolate and it didn't have any affect. I will try the negative and see if that works.
  • huppertatorhuppertator Member Posts: 34
    Yeah that didn't work. Still the same thing.
  • huppertatorhuppertator Member Posts: 34
    @vgannetti23 - that worked. It's just a pain to have to make a separate actor of the same thing for every spot it will be in. But oh well, as long as it does what I want. Thanks.
Sign In or Register to comment.