Drakkith's Forum Posts

  • It's just a basic event. If sprite's instance variable is 1, then perform action X.

  • Those angles are incorrect. Zero degrees is directly right and angles increase clockwise from there. Down is 90 degrees, left is 180, up is 270.

  • Try (round((21/20)*100)/100

    This will divide 21 by 20, giving you 1.05, multiply it by 100 to give you 105, round to closest integer (if it wasn't already an integer) and then divide by 100 to give you 1.05.

  • You do not have permission to view this post

  • The "rotate towards angle" action will rotate the object X degrees per tick towards Y angle. Try setting your car.car.steerspeed to a low non-zero value.

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • How do you have your events set up to fire the bullet? You should be able to do a "if player is mirrored, then set bullet movement angle to 180" type of event, assuming you're just mirroring the players sprite for left and right movement.

  • Thanks all! I'll try them out and see how they work!

  • Hey all.

    I'm playing around with a tower defense game, and I'm trying to have a turret target all enemies within a range of 100 pixels and shoot a "bullet" at them when the turret is clicked. This bullet is actually a spider-thing that will do damage over time to the enemy, so I want the turret to only target the enemies that don't already have a spider-thing on them.

    Any ideas?

    Thanks.

  • Would this be a sub event? Since this happens after the enemy dies. I'm a bit confused on how to make this happen. Should I make two Global Variables, which is what you mean by Compare two variable?

    I apologize, I just need more clarification.

    Event: Enemy: On Destroyed.

    Sub Event: System: Compare two values: random(100) less than 60. Action: Enemy: Spawn Another Object

    So when an enemy is destroyed the sub event check is triggered. Then the game rolls a random number between 0 and 100 and if the number is less than 60 the check returns as true and the action following it runs. If the number is 60 or above the check returns as false and the action is not run.

    If you want to be able to change what the number is checked against you can create a global variable. Then your action becomes: Compare two values: random(100) less than GlobalVariableName.

  • I'm not sure if Construct 2 supports the reading of a smartphone's accelerometers.

  • You're going to need to provide more details if you want help. Are you using the 8-direction behavior for the player? Have you got your targeting icon to work properly? Are you wanting to make your player face in the exact direction of the target, or just in one of 8 directions? Etc.

  • you can try:

    1/on event: pirate_ship rotate X°*dt toward angle player.angle

    2/pirate_ship within 5° of player.angle: action (eg fire)

    If that's work, you can improve the rotation and/or distance

    I believe the phrase "player.angle" returns the angle that the player's sprite is facing, not the angle from the current sprite to the player.

  • Angles are notoriously difficult to work with in my experience, but you can try this:

    Have two instance variables on the pirate ship called "AngleToPlayer" and "DistanceToPlayer"

    Use the following events:

    E.) System: Every Tick: A.) PirateShip: Set Value: AngleToPlayer: "angle(self.x, self.y, player.x, player.y)": A.) Set Value: DistanceToPlayer: "distance(self.x, self.y, player.x, player.y)"

    E.) PirateShip: Compare Instance Variable: DistanceToPlayer is less than X: A.) PirateShip: Rotate Towards Angle: "Self.AngleToPlayer + 90"

    Sub E.) PirateShip: Is Within Angle: 5 degrees of "self.AngleToPlayer + 90": A.) Insert whatever event you need to make the ship fire.

    Note that this makes it so that the ships always fire from one side. You can use the event "is clockwise from angle: self.AngleToPlayer +90" and the inversion of that same event to help you make the pirate ships to turn one way or another. You'll have to change +90 to -90 in some of the earlier events, and +270 if the angle from the pirate ship to the player is less than 90 degrees and you want to fire at the player from the right side of the ship.

  • Create an instance variable called "Direction".

    Then have an event that performs the action on the instance variable "set value" and type in "floor(random(1,9))". This generates a random number between 1 and 9 (not including 9) and then rounds it to the lowest integer, giving you a whole number between 1 and 8 (including both 1 and 8). Then you'll need an event that checks this instance variable and if it is 1 performs the action "simulate control: right" (The 'right' option appears after you select the 'simulate control' action).

    You'll actually need 8 different events with each one checking for a different number. Each event's will then do the "simulate control" action. For the diagonal directions, you'll have 2 actions. For example, if 2 is the number generated, then your event checking to see if the number is 2 will have one action for "Simulation control: right" and another for "simulation control: down", and your object will move down and right.

    An additional action for each event would be to set the animation sprite to a certain frame (or animation) for each number. I don't know the details of your game, so I can't give you a specific way of setting this up. It depends on what the object is doing, when/why it changes direction, etc.

  • Up.

    Can anyone tell me a way to make the character turn to a place immediately and without help control the keyboard. I can continue the work. Please.

    If you are using a sprite for your targeting icon, you can use the action "set angle towards position" and then for the X and Y positions type in "TargetingIcon.x" and "TargetingIcon.y" where "TargetingIcon" is the name of your sprite.