Making an Enemy

acousticrifferacousticriffer Member Posts: 8
edited November -1 in Working with GS (Mac)
How do I make a enemy that starts off camera and will either try and always get to the main actor or move around in a random fashion? I'm also wondering how I can make my collision detection such that if any character were to leave the background, they would be stopped or bounced. Any help or direction would be greatly appreciated

Comments

  • quantumsheepquantumsheep Member Posts: 8,188
    Just be rude and condescending... that usually works :D

    OH!

    I see!

    Making them move towards the character's easy.

    Make two integer variables - playerX and playerY

    In your player character constrain the variable 'PlayerX' to the player's position.x and the variable 'Player Y' to the player's position.y.

    On your enemy have the rule:

    Move to position:

    > PlayerX ^PlayerY

    Hope that helps get you started!

    QS :D

    Dr. Sam Beckett never returned home...
    Twitter: https://twitter.com/Quantum_Sheep
    Web: https://quantumsheep.itch.io

  • iDeveloperziDeveloperz Member Posts: 1,169
    There is a collision behavior.

    So in the main actor add the behavior

    Collide with actor of type: Wall.

    By wall I mean another actor. It isn't a keyword or anything.
  • acousticrifferacousticriffer Member Posts: 8
    Well it worked in making the enemy go towards my main actor, but now my main actor won't move :( any ideas? Thanks for that incredibly quick reply btw!
  • acousticrifferacousticriffer Member Posts: 8
    acousticriffer said:
    Well it worked in making the enemy go towards my main actor, but now my main actor won't move :( any ideas? Thanks for that incredibly quick reply btw!

    EDIT: My bad, you were totally right, I flipped your instructions. It works perfectly, you're the best!
  • acousticrifferacousticriffer Member Posts: 8
    iDeveloperz said:
    There is a collision behavior.

    So in the main actor add the behavior

    Collide with actor of type: Wall.

    By wall I mean another actor. It isn't a keyword or anything.

    When I do that, the character gets bounced off because my background is behind him. any advice?
  • iDeveloperziDeveloperz Member Posts: 1,169
    Hmm, sorry I can't visualize what you are trying to do. Could you upload it to gamesalad so I can have a play?
  • acousticrifferacousticriffer Member Posts: 8
    i can post unfinished games? its really silly and more of a test how to do everything in game salad kind of thing.

    I have my "background" actor. He is stretched to be about 1500x1500 for the whole level.

    The way I have it now is that if the character goes off of the background, it restarts the scene, but I'm not liking that very much and would like to make it so that the character can't go off of the background at all. If i just do the collision between the character and the background, since the whole scene is based on the background, they immediately touch and the main character disappears. I need to somehow make a rule that constrains the main actor to the background
  • iDeveloperziDeveloperz Member Posts: 1,169
    Can you send me the project and Ill do it for you and tell you how i did it.

    ideveloperz@googlemail.com
  • acousticrifferacousticriffer Member Posts: 8
    sent. thanks!
  • iDeveloperziDeveloperz Member Posts: 1,169
    Hope I helped.

    :)
Sign In or Register to comment.