oosyrag's Forum Posts

  • Hi, I don't see anything wrong. What is your question?

  • You need an expression to get the angle between Sprite1 and Sprite2 with a little math using arctangent (atan(x)).

    The angle between the two is atan((Sprite1.Y-Sprite2.Y)/(Sprite1.X-Sprite2.X)).

    Edit: Never mind!! I didn't even realize there was a specific angle expression for that. Angle(x1, y1, x2, y2) - Calculate angle between two points

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • Layout scale is a system action.

    Set up a condition for when you want to zoom, such as On Start Of Layout. (Or on key press, or touch, ect.)

    Then use the action System - Set Layout Scale.

  • If you want it to go uphill, you'll need to either add force or impulse.

    https://www.scirra.com/manual/98/physics

    [quote:3d57i5m2]Apply force

    Apply force at angle

    Apply force towards position

    Apply a force on the object, either at an angle, towards a position, or with custom X and Y axis forces. Applying a force causes the object to accelerate in the direction of the force. Forces can be applied from an image point or the object's origin.

    Apply impulse

    Apply impulse at angle

    Apply impulse towards position

    Apply an impulse on the object, either at an angle, towards a position, or with custom X and Y axis impulses. Applying an impulse simulates the object being struck, e.g. hit by a bat. Impulses can be applied from an image point or the object's origin.

  • First to address refactoring and compacting your event structure, my advice is to not worry about it at all unless it becomes a problem and you have performance issues! I know how satisfying it can be to go over your code and make everything more compact and efficient, but often the way you first imagined the logic to work out in your head is how you set it up in the first place, and that will be the easiest to understand and read for you later, while extremely compact code might be difficult to decipher later down the road when you have a lot more to think about.

    That said, the simplest solution is often the best solution, so sometimes if you find your code getting too complicated, it might be a good idea to step back and see where things could be simplified.

    In this case, given that your movement is working properly with each direction and diagonals, I would separate the feet animation code from the keyboard input code. Use a variable to keep track of which direction they are going (1-8) and play the correct animation based on that variable.

    You might be able to save some animation frames by using the "Mirror" action too, but that can introduce some new complications as well so I would leave that for after you get it working the way you want first.

  • Remember that everything on the event sheet is run from top to bottom logically.

    So in this case, maybe your mouse is overlapping Family1, so it changes to crossredot. but it is also not overlapping Pickups1, so it immediately changes to crossgrey, so you never actually see crossredot.

    Using the system condition "Else" would be useful here. You can read about it here https://www.scirra.com/tutorials/292/gu ... t-features

  • Here is the manual entry for gamepad - https://www.scirra.com/manual/143/gamepad

    I think what you are looking for is the following expression:

    [quote:1d48ezpy]Axis(Gamepad, Index)

    Retrieve the current position of an analog joystick on a specific gamepad. Index specifies left analog X and Y or right analog X and Y axes, subject to Key mapping. Axes range from -100 to 100. Axis values within the Analog deadzone are returned as 0.

    So use this to get X and Y values that you can use in the arctangent formula.

  • Off the top of my head I believe the best way to pause is to put everything (except the pause code) on your event sheet in a group, then disable that group to pause. This should stop everything and anything from happening.

  • What is your stick? Is it a controller's analog stick (gamepad object), or did you create a touchscreen analog stick with sprites?

    The formula for getting angle in degrees from coordinates is atan(changeinY/changeinX)

    If you are making your own touch analog stick - compare stick's current position to the origin position to get change in Y and change in X, use the formula to get your angle from origin, and then use Move At Angle.

  • You need to set the angle of the particle effect when your character turns around.

    How are you having your character sprite turn around? If you are using mirror, add an extra action whenever your mirror your character, use Particle: Set Angle - 180-self.angle.

    Or you can use a variable to keep track of which way your character is facing, and change the particle angle whenever that changes.

  • Add a "System: For Each - Unit A" to your very first condition.

  • Try starting with the basic example. Go to New Project, and look for Example: Touch - Panning.

  • Use the action:

    Move at angle
    Move the object a number of pixels at a given angle in degrees[/code:j92xkjfx]
  • If you are creating the doors dynamically off screen as the screen moves -

    Create variable NextDoor.

    When a door is created, add 1 to NextDoor.

    If NextDoor > 12 - Set NextDoor to 1

  • I was assuming you were saving the JSON format to disk or webstorage/local storage, then using an AJAX Request to load the saved data. Then you can access it with LastData. Also assumed your JSON data came from an array to begin with.

    For reference for your array load question, if you have the ""{"c2array":true,"size":[7,2,1],"data":[[[1286],[885]]... ect" data (JSON format of array data) in GlobalVariable, you can use Array.Load on that GlobalVariable.

    But glad you figured it out anyway!