sgn15's Forum Posts

  • thomas Harding

    I can't make something out of those large pics. I mean just a simple diagram made from MS paint or a screenshot of your layout view in C2 would help explain what happens in your game (aside from what you have explained so far) since you said the sensors did not worked out so well. I don't know how you did it specifically.

    Aside from sensors, you can also check your distance (between player and enemies) as another condition for enemy AI.

    You might also want to use instance variables to store the direction an enemy is currently facing. So an enemy who is facing right that overlaps a sensor will go left, while an enemy facing right that overlaps sensor will go left. something like that.

    Try to summarize the things you want to take into account with in the AI mentally or in a piece of paper before trying to code them. Good luck.

  • Platform behavior objects can use "has a wall (to left or right)" condition. You can use that combined with a key press condition. Check if it works with gravity or with no gravity.

    Note that platform objects will still fall down even if gravity = 0 if not on top of solid or jump thru. Set Vector Y = 0 to stop moving vertically (though you want to go up or down when beside a wall, so you probably don't need this)

  • I did not download the file because I'm not on a pc with C2, but I also had a situation like that before, I just spawned a jumpthru object right on top of solid but the jumpthru is 1 pixel taller than solid

    I think solids have a problem if they overlap each other

    and make sure (using debug) that the solid you are disabling is the correct instance

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • Just set angle of motion, gravity, speed and acceleration for any object with bullet (make sure you enable it at time of created) and it would work like you wanted.

    No need for equations or variables.

    Set "Set Sprite Angle" to Yes so the object would automatically angle according to its "angle of motion".

    And yes, I have made it to work like that. It's simple.

  • floor(random(5)+1 will result in 1,2,3,4,5

    Better yet, skip the random and use

    choose(1,2,3,4,5) = 1

    this means 20% chance (or 1 out of 5 chance) of choosing 1st car, then do the same for other cars

    choose(1,2,3,4,5) = 2

    choose(1,2,3,4,5) = 3

    choose(1,2,3,4,5) = 4

    choose(1,2,3,4,5) = 5

  • Can't you just use vector x when ball is on floor when the solid (floor) it is on top of's angle is not = 0 ?

    As for the spinning animation, you should put your axis in the middle of the ball and just rotate your ball's angle (again when the floor's angle is not zero and ball is on floor).

    you might need to use some instance variables to set if going left or right (or just check the angle of the floor)

  • do they overlap?

    spikebase overlapping with base

    for each base

    for each spikebase

    spikebase (is pinned)

    ->pin spikebase to base (or the other way around, did not really understood your game explanation)

    to pick a corresponding partner

    pick base

    base.UID

    =

    spikebase.pin.pinnedUID

    or

    pick spikebase

    base.UID

    =

    spikebase.pin.pinnedUID

  • you might want to show a diagram or the screenshot of your layout because I don't know the theme/logic of your game

  • Ok. I would suggest making sensors (invisible objects). Better yet, make different sensors for different movement directions.

    If enemy overlaps sensor_right, move right.

    If enemy overlaps sensor_left, move left.

    and so on.

    then you can also check line of sight or distance from player.

  • If player and enemies are running horizontally, then you pass through the vertical sensors. I mean "vertical" as a thin long vertical line (shape of sensor).

    Not sure if we are misunderstanding each other.

  • adding "i" to the third parameter in RegexMatchAt should ignore letter-casing (for future reference)

    like this?

    int(RegexMatchAt(Player.AnimationName,"animation(\d+)", "i",1))

    where you read that (adding "i") btw? I did not see it from system expressions in manual just now?

  • Oh, finally got it to work!

    Thanks for taking note of the lowercase issue.

    My animations are Animation1, Animation2, and so on.

    It works now. My bad. Noob mistake. Thanks again.

  • Also tried saving the anmation name into a text variable first, then referencing the text variable inside regex.

    Still not working.

  • IndieKiwi

    for some reason, it doesn't work when I use the Player.AnimationName directly

    any tips to solve this?

  • IndieKiwi

    It's not working.

    What did I do wrong here?

    int(RegexMatchAt(Player.AnimationName, "/animation(\d+)/", "", 0))