Sushin's Forum Posts

  • I'm not sure if I understand you right. But if so, then you have to calculate the angle FROM the enemy TO the player, not the other way round.

    Scenario:

    Player is at (100, 100) with a zone of radius 50. Enemy is at (250, 50)

    Now the angle from the player's perspective to the enemy would be ~341.57?. But the angle you need is the one from the enemy's perspective to the player, which is ~161.57

    The rule is that the first pair of coordinates in the angle expression has to be the one of whose perspective you're trying to get the angle.

    angle(playerXY, enemyXY) => the angle that points towards the enemy

    angle(enemyXY, playerXY) => the angle that points towards the player

    But that's not all in this case. You also want to move the enemy from its current position to the proximity zone of the player, which in this case is a 50 pixel radius around the player. So you have to SUBTRACT that radius from the total distance between enemy and player.

    The enemy calculation would then look something like that:

    self.x + cos(angle(self.x, self.y, player.X, player.y)) * (distance(self.x, self,y, player.x, player.y) - 50)

    self.y + sin(angle(self.x, self.y, player.X, player.y)) * (distance(self.x, self,y, player.x, player.y) - 50)

    You would need to replace 50 by the correct radius.

    Works like a charm! Thanks a ton.

  • Good to see you're solved your problem by yourself. But, as I made such an effort to draw such a nice graphic, I will post a more general info that also takes into account the diameter of the ring.

    <img src="https://dl.dropboxusercontent.com/u/11182740/construct/donut.png" border="0" />

    c = center

    a = angle

    r = radius to outer boundary

    r' = radius to inner boundary

    p = new point within destination zone

    d = distance from r' to p

    a = random(360?)

    d = random(r - r')

    p.x = c.x + cos(a) * (r' + d)

    p.y = c.y + sin(a) * (r' + d)

    That's a nice graph. It helps me understand what's going on a little more, but I'm actually having a problem with something else now.

    I'm trying to make the enemy go to an area that is around the player based on their current position, so if the enemy is too close to the player, he will back off. If he's too far, he gets closer. Basically, I want the enemy to move into the area around the circle by moving to and from the angle direction between the player and the enemy.

    This is what I have but it's not quite working. The angle is off-set at a weird spot. <img src="http://puu.sh/4gSoq.png" border="0" /> I'd appreciate your help a second time.

  • ...No. It wouldn't work that way. Anyways, I found the math. Here is the solution for anyone with a similar problem.

    <img src="http://puu.sh/4gNw9.png" border="0" />

    If you set "Patrol Area" to a random positive number, it will go to a random circular point that as far away from the object as that random number is.

  • Hi guys. I'm trying to make a natural looking patrol point for my AI but I really don't know the math I should be using. Here's what the area will look like.

    <img src="http://puu.sh/4gCX3.png" border="0" />

    I know it will involve a maximum radius and a minimum radius but I really don't know how I could designate a point within that.

  • No but I was thinking about putting ads in future games.

  • So far I've been posting my games to Newgrounds, Kongregate and GameJolt and they get decent views, with the most views always being on Newgrounds due to the judgement system.

    But what other notable sites are there to submit html games to?

    Specifically i'm looking for user submission sites but I'm also interested in non-user submission.

    I don't know many that haven't made the leap from flash games to html and unity games yet. There's a TON of flash game sites.

  • All I can say is just stretch it.. BIG TIME. That's what I do, and it's the only way that has proved successful (because it's the only one I've tried and it works! [I use scale outer if that helps deciding on a future method.])

    This seems to only be a problem when scale outer is being used.

    Another problem is that I'm trying to center some text on the screen, but it just doesn't work since I'm using window width.

  • nother bump..

  • one more bump

  • bump..

  • I'm using fullscreen with scale outer and I'm having big problems getting the background to be the same size as the window. The background seems to set it's width to a wrong number based on the size of the screen.

    Here's the first thing I used to set the width:

    <img src="http://puu.sh/3W4yk.png" border="0" />

    And the results on a stretched out screen (for testing purposes)

    <img src="http://puu.sh/3W4uX.jpg" border="0" />

    So I tried this, but it doesn't seem to work either:

    <img src="http://puu.sh/3W4tx.png" border="0" />

    <img src="http://puu.sh/3W4xD.jpg" border="0" />

    So is there anything else I can do to get the background to span across the entire screen?

  • Sorry for ignoring the form but this isn't so much of a bug as it seems to be a mistake or oversight.

    You can scale sprite text in the properties bar, and in the actions, but you can't compare the scale of the sprite font, nor does scale appear here: <img src="http://puu.sh/3Uv3h.png" border="0" />

    Changing width and height obviously don't work because it just changes the size of the box.

  • I wanted to use a text box for a mobile game exported with CocoonJS but that doesn't support C2s text boxes. Is there another way to get it to work?

  • You can use the new Timer behaviour.Oh my god...

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • Um...A timer.

    Here's what it would look like:

    Event: Touch Powerup

    Action: Player.PowerupTimer = 3

    Action: Player.Powerup = True

    Event: Player.PowerupTimer > 0

    Event: Player.Powerup = True

    Action: Subtract dt from Player.PowerupTimer

    Event: Player.PowerupTimer <= 0

    Action: Player.Powerup = False

    Something like that anyway. Basically the 3 is in seconds and you subtract the time from 3, and while the timer is above 0 seconds the powerup is active.