Menu

enemy dilema

2004-11-13
2012-12-25
  • Nobody/Anonymous

    a puffer fish! once a player jumps on it it kills the fish, if player runs into the fish it hurts the player. i CAN do all that, only thing im baffled about is jumping on the puffer fish hurts player rathet than killing the fish. the only way i see around this is to make tiny triggers on the puffer fish trail than when sprite puff fish touches trig create sprite relative to trigger then deletes afterward. the blown up fish is larger so maybe it will hide the un blown up puffer fish?

    is this a good way to attempt this? or does any one have an easier explanation?

     
    • Nobody/Anonymous

      just use
      Sub Player_OnPlayInit()
      EnemySpr = ProjectObj.gamePlayer.rMap.SpriteDefs("oEnemy").MakeInstance
      PlayerSpr = ProjectObj.GamePlayer.PlayerSprite
      End Sub

      Sub Player_OnBeforeMoveSprites()
      'detect to see if the enemything is in contact with
      'what part of your 'pufferfish??'
      'first you need to set two varibles for spr's. which
      'was what we did in our OnPlayInit sub..
      If PlayerSpr.Y = EnemtSpr.Y - 10 And PlayerSpr.X = EnemySpr.X Then
      'add the script to remove the EnemySpr
      End If
      End Sub

      'make sure that in your script, replace the oObjects
      'with whatever you named those sprites yourself
      'from within the SGDK enviroment.

      As for removing the sprite... use this
      With ProjectObj.GamePlayer.PlayerSprite
      .rDef.rLayer.RemoveSprite(0)
      'im not sure what index the EnemySpr is but just
      'trial and error it, replacing 0 with 1 or 2..., until
      'you finally remove the EnemySpr...lol...

      'I hope it helps...
      '-Cole
      'P.S. That script should run without any error other
      'than trying the line....
      If PlayerSpr.Y = EnemtSpr.Y - 10 And PlayerSpr.X = EnemySpr.X Then
      'try EnemySpr.Y - 8 or something to get what you
      'like.... you'll just have to try and see.... or try
      'using EnemySpr.X - 5 to allow the player able to
      'be somewhat over the enemy perhaps give or take
      'a few pics....
      'Good Luck!! And happy Gaming!!!!

       

Log in to post a comment.

Want the latest updates on software, tech news, and AI?
Get latest updates about software, tech news, and AI from SourceForge directly in your inbox once a month.