Excal's Forum Posts

  • I'm still convinced the touch system in C2 is bugged. I have yet to see a demo with multiple touches that use TouchID instead of TouchIndex work. In particular, I've looked through the Creations forum and didn't find a single multitouch dual-analog game, so it could be that I'm trying something others haven't with C2 yet.

    If someone can take a look at the .capx file, that would be awesome. The link on the first page is the updated link, but for anyone else: SpaceGame.capx

  • Alright, I've switched to using CustomMovement behavior. It seems to be mostly working now (link is updated).

    However, what's with the fire rate of Turret? It seems to fire really randomly and not according to my set fire rate except in a head-on angle.

  • Wait, what? I said touchindex doesn't work for this. You can't use touchindex for analog sticks.

    TouchIndex is used if touch positions don't matter, but instead the number of touches matter.

    In my game, only two touches will matter: a touch on the left and the touch on the right. Beyond two touches, nothing should happen. This makes TouchIndex less useful than TouchID, which according to jayderu is what you have to use.

  • I checked out your solution and I'm a bit confused.

    It uses TouchIndex, which doesn't really solve my problem. You have to use TouchIDs to handle simultaneous touches.

    When I touch the right side of the screen, the debug says the first touch is on the left, which is incorrect.

  • EDIT: Nevermind

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • I guess one of my issues is that as soon as the enemy is outside 'close range', when I set the bullet angle of motion back toward the player, this causes the speed of the enemy to instantly change. There is no acceleration that slows the enemy ship down and then causes it to move towards the player - it just magically changes motion.

    Should I be using CustomMovement for this instead of Bullet?

  • I need some help. I'm trying to create an AI that closes in on the player, then backs away after a certain distance. The idea is to create an AI that rushes the player, then goes off to the side while still shooting (strafing).

    <img src="http://i.imgur.com/xDcqr9d.png" border="0">

    For those checking the .capx:

    -CloseRange is the range in which the AI should be close to the player and needs to start moving away.

    -Right now I'm only testing to try to get it work for the player. The AI currently does not detect asteroids and account for them.

    -Please test using keyboard only, since touch controls are not working properly at the moment.

    SpaceGame.capx

  • You are likely to experience quality loss by scaling up. Imo, it's better to develop for a large 16:9 aspect ratio and then have C2 scale down.

  • For anyone else who might be able to help, I'm still not able to get both touches working. When the second touch happens, things go wrong.

    SpaceGame.capx

  • philx

    Can you share your .capx?

  • Another tip on the AI: You can fake it a bit with a trail behind the enemy as well. Use angles to avoid the enemy as you stated, but create an invisible trail of 3-5 invisible sprite dots behind the enemy. If spots are seen, the AI can go to them and follow each one towards the first, making it seems like it's following. Then, once the angle is right, the AI shoots. ;)

    This seems a bit inefficient. If the angle >= 90, just mark the player's current position as soon as you go into the Move state and have the AI pathfind to that spot.

  • philx

    I'm doing the same thing, except without the object in order to save memory.

    Mine detects whether they've touched the left or right side of the screen:

    Touch.X > ViewportRight("TouchInterface")/2 and Touch.X < ViewportRight("TouchInterface")/2

    However, I'm having issues when both the left and right are touched at the same time. Namely, the second touch ID reverts back to -1 almost immediately.

  • To further clarify, I have created images showing how the AI should behave according to certain conditions:

    <img src="http://i.imgur.com/eNay9B6.png" border="0" />

    In the situations above, even if the player turns, the AI should still end up positioned behind the player or head-on with the player (the latter of which causes the AI to enter 'fire' mode and try to just shoot down the player).

    This implementation should be easy - just have pathfinding find an optimal path to the player's current position.

    <img src="http://i.imgur.com/dj1TRrB.png" border="0" />

    If the angle from the AI's position to the player is less than 45 degrees, the best course of action is to simply engage the player since the player is most likely going to be attacking the AI ship soon.

    So the hard part now is determining the perpendicular position.

    Once this is all set up, it shouldn't be too hard to set up a random counter to make the AI ship run away sometimes as well.

    The question is: How do I determine the 'spot' mathematically?

  • I had typed up all my notes, but the 'Authorization Error' I seem to get every now and then on this forum happened, and I'd rather not type it all up again (why isn't this fixed?).

    Here is a brief version of my notes on this.

    Two States:

    -Move (starting state)

    -Fire

    Fire:

    -If in Fire, set variable PredictedFiringAngle = angle(Self.X, Self.Y, Player.X, Player.Y) + asin((Player.Speed * sin(angle(Self.X, Self.Y, Player.X, Player.Y) + 180 - Player.MovingAngle))/ SelfBullet.Speed)

    -Update this variable before every fired shot

    -If Player is within 50 pixels of self, do not end this state, instead just keep firing at the object's fire rate

    -If Player's angle = angle(Self.X, Self.Y, Player.X, Player.Y) + or - 10 degrees for 1 second or more then Player is facing the AI and the AI should turn and fire back.

    -If Player is beyond 50 pixels of self, set state to Move after several shots

    Move:

    -If Player's angle = angle(Self.X, Self.Y, Player.X, Player.Y) + or - 10 degrees for 1 second or more then Player is facing the AI and most likely firing, so enter Fire state.

    -If Player is within 50 pixels of the AI, immediately enter Fire state and fire upon the player.

    -AI should try to move behind the player and avoid flying into the path of the player (avoid dumb AI)

    -???

    Any thoughts on this?

  • I'm all for the wiki and increasing the 'general knowledge' of the community as a whole.

    There are a lot of ways to implement something in Construct 2. This freedom is great because it allows people to come up with creative solutions, but it's kind of like reinventing the wheel: there are lots of ways to do it, but there is likely a 'most efficient wheel' and for production purposes, it's best to use that. So for all the 'solutions' that are possible, it would be nice if there was a place where the 'most efficient while remaining clear' solution was to be found.