calminthenight's Recent Forum Activity

  • You need to define what away is. For example, away could be: somewhere between 500-600px in a 360° area from current position, not overlapping an object.

    Then when it is time to trigger the enemy to pathfind away, you can use that logic to set the pathfind destination.

  • Make sure you don't have the unbounded scrolling option selected in the layout properties. Shouldn't need clamp if map is same size as layout.

    This code works fine with unbounded scrolling off.

  • Trust in ROJO. I'm sure the simplified version of my response will work.

  • You don't need to use 8 direction or sprites, you can use the 'scroll to' action and some maths to determine your speed and direction.

    Create 4 static variables: TouchStartX, TouchStartY, TouchAngle, TouchDistance.

    1. 'On any touch start' you want to set the TouchStartX&Y variables to touch.X&Y

    2. 'Is in touch' you want to set the angle and distance variables to: angle(TouchStartX,TouchStartY,Touch.X,Touch.Y)-180 **-180 is to reverse the direction.

    distance(TouchStartX,TouchStartY,Touch.X,Touch.Y)

    As a sub event of 'is in touch' you can use the

    3. 'scroll to' action and set the values to lerp from the current scroll coordinates to the angle and distance of the touch action.

    lerp(scrollx,scrollx+cos(TouchAngle)*TouchDistance,1-dt*0.5)

    lerp(scrolly,scrolly+sin(TouchAngle)*TouchDistance,1-dt*0.5)

    4. 'On any touch end' reset all variables to 0.

    For your UI elements, create a new layer on top and set it's parallax settings to o. This layer won't be affected by any scrolling and your buttons and text will remain in place relative to the viewport.

  • You want to use the "Is within Angle" condition instead of what you have used in your events.

    You can get the gamepad left stick angle by using angle(0,0,Gamepad.Axis(0,0),Gamepad.Axis(0,1)).

    This will return values from 0 to 180 and 0 to -180 which you can convert to 360° angles if you like (not neccessary but I think it's cleaner) by checking for values less than 0 and adding 360.

    Example below

    Now you can use the "Is within Angle" conditions in your code to compare that angle and set the appropriate movement and sprite.

  • It's likely a Chrome issue and not a Construct issue. Go to this site and test if your gamepad works there: gamepad-tester.com

  • This is for getting the angle of a gamepad joystick: This example uses the right joystick: angle(0,0,Gamepad.Axis(0,2),Gamepad.Axis(0,3))

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • It's in the browser object. Request Fullscreen and cancel fullscreen actions.

  • Provided the top level conditions are correct this event will run continuously every tick. I think what you want is a triggered event, or more likely a function to run this inside of.

    Hard to tell anymore looking at the code. It looks overly complex for what you are trying to describe. An array does not seem to be necessary.

    On your selection screen you could use something like:

    On gamepad 0 button (whatever your select button is) is pressed

    Pick CharacterSprite overlapping CursorSprite0

    - Set var_P1 to CharacterSprite.var_name

    On gamepad 1 button (whatever your select button is) is pressed

    Pick CharacterSprite overlapping CursorSprite1

    - Set var_P2 to CharacterSprite.var_name

    etc.

    If you don't want to store them in variables I would use a dictionary and instead of:

    - Set var_P1 to CharacterSprite.var_name use - Dictionary SetKey "P1" to CharacterSprite.var_name

    Arrays are more useful when you need to manipulate the data within them. If you just need to store values Dictionaries are much easier.

  • You can use ray tracing. Cast a ray at the angle of your player. If the ray intersects with an enemy then return the hit XY coordinates. then you have small (often red) square sprite that is attached to the imagepoint of your players gun. You then set that sprites width to the Hit distance from the ray tracing.

    Have a look at this example. It is around the other way (as in the player targets the enemy) but it has the same basic functionality.

    1drv.ms/u/s!AkmrWgxeuxlKhJwJud2c1lT0FrvUFA

  • Have a look at this example. 1drv.ms/u/s!AkmrWgxeuxlKhJwIhgnAkuJzA6YOZw

    Essentially your game world just exists under the UI layer and is hidden when outside of the false screen area you have created.

    If you are making another game that is static, like pong for example, you need to define the coordinates of the false screen and apply that to your game code.

calminthenight's avatar

calminthenight

Member since 28 Jan, 2018

Twitter
calminthenight has 6 followers

Trophy Case

  • 6-Year Club
  • Forum Contributor Made 100 posts in the forums
  • Forum Patron Made 500 posts in the forums
  • Regular Visitor Visited Construct.net 7 days in a row
  • RTFM Read the fabulous manual
  • Email Verified

Progress

11/44
How to earn trophies