i have an enemy character that shoots when distance is 150 pixel away

im trying to figure out how to combine or take apart this character and the bullet character into a character that just fights my character when close distance

Comments

  • tatiangtatiang Member, Sous Chef, PRO, Senior Sous-Chef Posts: 11,949

    I don't know what any of that means but since you mentioned distance, you would use the magnitude() function to determine the distance between two actors. You can Google magnitude gamesalad for more information about it.

    New to GameSalad? (FAQs)   |   Tutorials   |   Templates   |   Greenleaf Games   |   Educator & Certified GameSalad User

  • tatiangtatiang Member, Sous Chef, PRO, Senior Sous-Chef Posts: 11,949

    I accidentally merged the wrong threads -- there's a first time for everything -- so I'm reposting @Socks' comment:

    When magnitude(heroX-enemyX, heroY-enemyY) < 150 the change game.attack to true

    When game.attack is true . . . . attack.

    New to GameSalad? (FAQs)   |   Tutorials   |   Templates   |   Greenleaf Games   |   Educator & Certified GameSalad User

  • tatiangtatiang Member, Sous Chef, PRO, Senior Sous-Chef Posts: 11,949

    Please don't create duplicate threads.

    From the FAQs:

    New threads can be created by clicking on the big purple New Discussion button at the top-right of the forums page. Do not create multiple threads for the same issue. You can find your existing threads by clicking on the My Discussions link at the top-right of the forums page.

    New to GameSalad? (FAQs)   |   Tutorials   |   Templates   |   Greenleaf Games   |   Educator & Certified GameSalad User

Sign In or Register to comment.