Enemy Movement ( what am I missing?)

Hey guys,

So I have done this many times and it has always worked, but for some reason it is not working for this game. This is just another basic enemy chase. Enemy patrols back and forth...when hero gets within 300, enemy stops and shoots. But for some reason it is not working for me this time. You will see in the demo that the enemy will just not move. His animation works and the stop and shoot, but not the patrol back and forth.... I know i am missing something, but I can't figure it out... Any ideas?

to get the hero to move just click with the mouse by the spiky ball

https://www.dropbox.com/s/kents5tk2hv5f64/Spiky-Blast 14-test.zip?dl=0

Comments

  • SocksSocks London, UK.Member Posts: 12,822

    The condition for Move Left is not met.

    (When self.X is larger or equal to self.startingX + self.myMax)

    When the game starts:

    self.X = 1041.5
    self.startingX + self.myMax = 1141.5

    Therefore the [larger than or equal] condition never fires and the actor doesn't move.

  • SocksSocks London, UK.Member Posts: 12,822

    There are a number of other strange things going on - but not knowing how the project is meant to work they could all be intentional . . . .

    For example in the Hero actor, you have

    Constrain playerX to selfX
    Constrain playerY to selfY

    and in the same set of rules you have

    Change playerX to selfX
    Change playerY to selfY

    The Change attributes will be overridden by the Constrains, basically they aren't actually doing anything.

    You also have - again in the Hero actor - an Animate behaviour that is 16 frames of the same image - which could be replaced by a single Change Image behaviour.

    But like I say, maybe these things are intentional (or things you are still working on).

  • SocksSocks London, UK.Member Posts: 12,822

    P.S game is looking good ! :)

  • quinn221quinn221 Member Posts: 280

    Correct I do have bunch of other stuff, I just stripped the game down so it was not huge for the demo. I do probably have to go through and clean up the logic as well.

    Even with you insight am still having trouble getting the enemy to move correctly. Here is what I am trying to accomplish. When the hero get close to the enemy the enemy will stop then shoot at the hero until the hero gets out of range. Once out of range the enemy returns to patrolling back and forth.

    What would be the best way to handle this...do you have any demos on this?

    Thanks!

    @Socks said:
    There are a number of other strange things going on - but not knowing how the project is meant to work they could all be intentional . . . .

    For example in the Hero actor, you have

    Constrain playerX to selfX
    Constrain playerY to selfY

    and in the same set of rules you have

    Change playerX to selfX
    Change playerY to selfY

    The Change attributes will be overridden by the Constrains, basically they aren't actually doing anything.

    You also have - again in the Hero actor - an Animate behaviour that is 16 frames of the same image - which could be replaced by a single Change Image behaviour.

    But like I say, maybe these things are intentional (or things you are still working on).

  • quinn221quinn221 Member Posts: 280

    @Socks said:
    P.S game is looking good ! :)

    Thanks... I feel like i have game ADHD going on..I have 3 games in the works at one time...I really just need to finish one up then move to the next. Again thanks for all your help you provide on all my projects.

  • IceboxIcebox Member Posts: 1,485
    edited November 2016

    @quinn221 This is something not related to your question. There is a thing here im not sure of maybe im wrong , but on earlier gamesalad builds it didnt allow you to type in a numeric expression in a condition..

    so for example if you want to calculate a distance and put it under a condition you had to do it this way , you constrain it to an attribute called distance and then use distance in a condition

    constrain self.distance to magnitude( self.position.x - game.playerx ,self.position.y - game.playery)

    and then you put if attribute self.distance is < 300
    do something

    This is what tutorials have on youtube cause it was using the older version.It used to be like this

    but now you have access to numeric expressions

    so you can do this instead

    if numeric expression magnitude(self.position.x - game.playerx , self.positiony - game.playery) < 300
    do something

    This way youll get rid of a constrain you dont need

  • SocksSocks London, UK.Member Posts: 12,822

    @Icebox said:
    This way youll get rid of a constrain you dont need

    That's exactly what I did too ! I did a quick look at the rules and got rid of all the extraneous stuff, that was the first to go !

  • quinn221quinn221 Member Posts: 280

    @Socks Ok I am struggling to get this to work. I following the above logic...but the enemy still will not move back and forth. I must be overlooking something

  • IceboxIcebox Member Posts: 1,485
    edited November 2016

    You can do it this way , if you want

  • IceboxIcebox Member Posts: 1,485

    @Socks Yea I remember i had a long discussion with you about magnitude sometime ago , and you explained that there is no need to constrain it to an attribute

  • quinn221quinn221 Member Posts: 280

    @Icebox said:
    You can do it this way , if you want

    Thanks @Icebox This is close, but the problem I am running into is when the enemy flips directions and the hero is out of range the motion of the enemy is backwards. I can believe how much time I have spent on this. Like I said I have never had this issue in the past, it has alway worked.

  • IceboxIcebox Member Posts: 1,485
    edited November 2016

    @quinn221 hmm strange works pretty well here tell me if you face issues with this , i used your graphics.

  • quinn221quinn221 Member Posts: 280

    @Icebox Perfect Thank you so much
    @Socks I think I need to learn more about cos and sin. I just found vid that Armelline did on the subject..... So much to learn!

    Thanks again Guys

  • fmakawafmakawa Member Posts: 565

    @quinn221 whats the link for the Vid?

  • quinn221quinn221 Member Posts: 280
Sign In or Register to comment.