aday's Forum Posts

  • 2 posts
  • Nice! Setting the angle first and then adding a rotate with a random angle works like a charm!

    Thanks for the help!

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • Sorry for the noob question, but I couldn't find the answer by searching and it's driving me crazy.

    Also, it might be something else incorrect that I'm doing because this seems too basic not to work.

    Basically, I want to set spawning sprites' angle towards the current mouse position, but with some random noise. I'm trying to spawn bullets towards the player, but not exactly at the player. (I want some "spread")

    I'm using:

    Set angle toward function with a value of:

    X = mouse.X + random(45)

    Y = mouse.Y + random(45)

    However, when I try running my game, it doesn't add anything random. It's treating it like the "+ random(45)" isn't there. If I take away the mouse.X and mouse.Y terms, whenever something is spawned, it's always at the same angle, like it's not creating a random angle. Strangely, it seems that each instance of the spawning sprite is offset by 45 degrees more than the last.

    What am I doing wrong??

    (First post, if I can somehow post my code, please yell at me and tell me to do so, but... I don't know how...)

  • 2 posts