Joy's Forum Posts

  • Thanks, but I can't get that to work either and I need a break. Just too frustrating not being able to figure out why stuff that should work isn't working. I'll probably try to make dummy animations and just post the .capx so you and anyone else can actually see it in action and what's happening.

    Thanks again for your time, I appreciate it.

  • Here's where I put it, is this still correct? The logic seems to make sense to me, but the enemy always plays all four animation frames before switching to enemystate "attack".

    [attachment=0:20dq7r4x][/attachment:20dq7r4x]

    Could you tell me where I could find in the manual (or elsewhere) how to write the expression for checking if any of a number of animations have finished? Basically I want to do something like:

    Enter the name of the animation that has finished: Animation: "enemykick1", "enemypunch1","enemypunch2" (that doesn't work of course)

    I seem to be able to find everything I don't need to know, but never what I do.

  • As an action for enemy_bbox is overlapping player_box (and I don't know why there were two of those 'overlapping playerbbox' there, I removed one).

  • It actually worked without making the last three events a subset of the first one, but I did it anyway because that could cause trouble later. Thank you very much!

    I'm not quite familiar with arrays yet, but I will make a note of what you wrote and try to put it to use later. Thanks for that too!

    One additional problem came up during the attack animation playback mess, but I hate to keep asking questions. In that large code example earlier, it shows the enemy will move towards the player's bounding box by checking X, moving, and playing the walking animation. The only thing is that in this case, the animation does not get interrupted when the enemy overlaps the player's bounding box, and enemy pauses to finish its four frame walking animation before the enemystate is set to "attack". I tried putting Stop animations, Trigger Onces, etc, but whenever they do work, they also stop the random attacks from beginning. Do I need to make another variable in order to cut off animation immediately?

    Again, thanks a lot for your time. I hope that this discussion and your advice will help other users too.

  • :deleted last post, I think I got it working: Does this look right? Thank you very much!

    [attachment=0:2bj5l5da][/attachment:2bj5l5da]

  • I'm sorry, but I don't understand how to write the code you recommended. For my example, would it be something like Add Condition -> Enemy Sprite -> Compare Frame -> Equal to -> "enemykick1" = enemy.5 -1 (I don't know how to write the last bit)?

  • I think I got it working by just having the enemy hitbox overlap an invisible player bounding box instead the two imagepoints. Probably was a combination of the overlapping imagepoints not working exactly as I thought (hope it's not a bug though) and the unusual movement system I'm trying to make. Thanks very much to everyone who suggested ideas!

    I do have another slightly-related question if you don't mind (and I'd rather not create a whole new thread for in case it's a very simple fix). Now that the enemy does stop once within range and begin to attack (by calling a random animation), I can't figure out how to force an animation to play all the way through before calling upon another random value. They keep getting interrupted as the random command is called 60 times per second.

    I tried Trigger Once While True and a few other methods I read in tutorials and none of them seem to work here. Like I said, I'm probably missing something very obvious, but I posted an example of the code with blank actions and was hoping someone could give me some advice. All of the movement that is now working is included in that example too. Hopefully it might help someone else avoid all the frustration I went through!

    Sorry to ask again and thanks in advance for your help!

    [attachment=0:2y59q18y][/attachment:2y59q18y]

  • Also, thank you Trultz for the new information (sorry I couldn't reply via PM, I don't have enough rep yet). I'm rebuilding everything slowly now and I will try your and Minor's methods as soon as I'm able. Thank you very much!

  • I appreciate it, thank you! Will take a look at it in a little bit and let you know. Hope you feel better soon!

  • Allowing the enemy to attack when it's stopped moving (so when it reaches the imagepoints) does work, but it's not what I need. I really do think I need states and variables because the enemy will do different things depending on what the player does, and it could get complicated.

    ...guh, my game is dead in the water if I can't find a solution that allows this (and I won't be able to justify buying the Personal version either). If anyone has any ideas that could help, even if it means completely redoing movement, I'm all ears.

  • Thank you for looking at the code. The strange thing is that if I don't try to make states using variables and just put actions to be run when the enemy is in position, everything works (the enemy does attack when it gets in range). As soon as I set up the EnemyAction variables though, the actions that take place when the enemy gets into range do not work. I really don't think it has to do with precision only because it works otherwise, that's why I thought something was wrong with my code.

    I do something similar to call on player attacks using variables to trigger animations to play, and they all work too. Just wish I could figure out what's wrong with this one event...

    I guess I'll try adding an actual sprite for the enemy to try and overlap instead of imagepoints and see if that works. Thank you for the help so far!

  • Your commands do work (thank you), but the problem still isn't fixed. I'm sure I'm just missing something simple here, so here's an example of the code. Sorry to bother you guys with this!

  • Thank you for your help so far, I will try what you suggested and post again in a little while.

    My sprites are attached to invisible primitive shapes that act as bounding boxes, and in this particular case, the enemy sprite moves towards the player until it's bounding box overlaps one of the two imagepoints on either side of the player. It actually works very well, there's just a tiny animation issue that I'll try to fix later. Got to fix this problem first.

  • Try Construct 3

    Develop games in your browser. Powerful, performant & highly capable.

    Try Now Construct 3 users don't see these ads
  • I changed the variables to numeric and I have the same results. I think the problem occurs when the enemy reaches one of the two Player's imagepoints (Player_Target.ImagePointX(1) | Player_Target.ImagePointX(2).)

    Could you tell me how you might add an action to determine when the enemy has reached an imagepoint and switch the instance variable from 0 to 1 (or whatever)? Whatever I'm doing, it's not right. Very sorry I can't post a capx now, I'm making this for a friend and I'm not supposed to share it yet. If we can't figure it out though, I'll try to make a dummy one and at least post screenshots of the code.

  • Thanks, but they all seem to be correct. No quotes in the default EnemyAction variable and all of the ones that are called upon have the quotes (or I get the error message saying it's an unknown expression).

    (oh you edited your post, thanks). I did try that once, but I'll do it again and post again shortly.