MrSheet's Forum Posts

  • 15 posts
  • Hey guys

    I'm making a top-down shooter with gamepad controls - left stick controls the player while right controls the crosshair. I'm using 8-directional movement for both player and crosshair.

    Currently I've managed to use simple formula where crosshair moves freely around the screen but when released it get's back to player's position

    Every tick -> cursor: set position to (lerp(Self.X, player.X, 0.025), lerp(Self.Y, player.Y, 0.025))

    I'm looking for a method to constrain crosshair's movement to specific distance from and to the player so it can fly away to maximum eg. 100px but also cannot be closer than eg. 30px.

    Something like in this image

  • Great answer! :D Thank you so much

  • Hi,

    I have a problem with Flash behaviour on my powerups. I want to make my powerups flash for couple of seconds before disappearing. Everything works fine when there is only one powerup on the screen - it flashes as it supposed to and disappears properly.

    The problem occcurs when there is more than one powerup - in that case the first one that was spawned (all powerups are randomly dropped by enemies) flashes but others don't. When their "flashing time" begins they may not be visible at all but I checked in the debug panel - they are still on the map OR they may be visible for the whole amount of the "flashing time" and then just disappear abruptly.

    Below is how the second variant looks like - both powerups were spawned in about the same time, but the upper won't flash

    I've tried different approaches

    -For each "powerUp" loop

    -Pick "powerUp" by evaluating powerUp.destructionTimer < 5

    -Pick all "powerUp"

    but couldn't find the proper solution

    Here are my events

  • Hi and thanks!

    I've done something similar to dop2000 post

    oOScuByOo

    I'm working on top-down shooter and I needed this detection to enable/disable certain controller specific events.

    For PC I need to hide all on-screen controls that are visible on mobile but also I had to disable mouse when using gamepad as one of my events for kb&mouse controls setting is "Every tick - player aim set angle to MouseX, MouseY" so even if the player is using gamepad the character was still aiming towards mouse position

  • Thanks for the reply but that is not something I'm looking for.

    Maybe I wasn't clear enough in my previous post - I want to detect input device dynamically to represent device used currently by the player. So in the example situation - lets presume the player uses PC and a gamepad - what I need is a way to detect if mouse was moved to change input device to "keyboard & mouse", and when player uses gamepad again it should change back to "gamepad".

    It works as expected using keyborad key press. The mouse movement detection is all I'm missing

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • Hello

    In my game I use three types of input controls

    -Touch

    -Gamepad

    -Keyboard & Mouse

    I want to detect input device dynamically according to one user is using.

    In the case of keyboard & mouse I want this to be activated using both - by key press and by mouse click or move.

    So far I managed to do everything except mouse move detection.

    My events

    So my question is - how can I detect mouse movement?

  • Thanks both of you

    tarek's method did the trick wonderfully

    here's an image if anyone else is intersted

  • Hi guys,

    I've got a problem with spawning enemies while multiple spawners are in player's range.

    I want to spawn one enemy whenever player gets near the spawner (in my example - less than 100px).

    Everything works fine when there is only one spawner within the player's 100px range (one enemy is properly spawned), but whenever more than one spawner is in player's range the enemies are spawning endlessly from all spawners except the first one.

    I've tried different approaches for measuring distance like:

    • System - distance(player.X, player.Y, spawner.X, spawner.Y) less than 100
    • above method, but with changing spawner's local variable "lod" to "1" when player is in range
    • using "line of sight" behaviour on spawners

    but all these methods produce the issue I mentioned earlier.

    I've tried also different ways to spawn enemies but without success

    • System - create object
    • spawner - spawn

    my events with all 3 methods of spawning

    and illustration of the issue

    It seems I'm missing something so any help would be much appreciated

  • Hey guys

    In my game I have a boxes that should do 3 things:

    • hurt the player (-1 health)
    • set private variable "is_hurt" to 1 (default 0)
    • bounce the player back

    These are my events

    Because I've set up my bounce like this (events 26 & 27) the player is bounced back immediatelly when he collides with kill_box and the variable "is_hurt" is not toggled at all.

    The variable toggles only when I walk into the kill_box fast or slowly two times, see below

    webmshare.com/play/nrGnb

    Is there a better way to detect collision so my variable will change value before the player is bounced back?

  • Hello again

    I'm currently working on dying animation and I've encountered two issues:

    1. When player hits killing block he's always knocked back to different distance.

    2. When player collides with said block while jumping he's thrown very high in the air. See here

    While I could live with first thing, the second is really annoying and I really can't understand why this is happening. I tried using set air acceleration or jump strenght to 0 but this doesn't work.

    This is how my events look

    Help with both issues will be much appreciated

  • Thanks Jayjay, but unfortunatelly it doesn't worked

    Although I've made it differently

    I've added a variable to the player called "is_jumping", and then my events looks like this

    1. Player is on ground - set "is_jumping" to 0

    2. Player is jumping - set "is_jumping" to 1

    3. Player is falling :

    • value "is_jumping" equal to 1 - play rolled animation
    • value "is_jumping" equal to 0 - play standard animation
  • Hey

    If someone was curious how I handled previous bullet issue - I've created another object just for gun, pinned it to the character and used events to point it to desired direction/angle. Works fine.

    Now I have another issue.

    In Contra there are two falling animations - one triggered when player jumps ("rolled" jump animation until player falls on the ground) and other when player walks off a floor edge (single frame from walking animation).

    I'm trying to recreate this but so far without success.

    Whenever I'm trying to make different animation played when player walks from a edge it interferes with rolled jump anim because condition "is falling" or "is not on ground" is triggered due to in game physics and rolled jump animation is played only to top arch of the jump.

    Does anyone has any idea how to bypass this and set two different fall animations?

  • Hey guys :)

    I'm trying to work out movement like in Contra games, with 8 directional shooting, and I've come up with silly issue

    My controls and animations are preety much ready, and everything works almost perfectly but this - after pressing Up Arrow the player's angle changes which allows user to shoot up, but then when player release Up, animation gets back to idle state but bullets are flying up instead of left/right.

    Is there a condition which I can use so the bullets will lose their ability to change direction once they are shot?

    My Events and screenshot of the issue

    i60.tinypic.com/30mqv85.png

  • That worked :)

    Thanks a lot jayjay :)

  • Hello guys!

    I'm trying to make a platformer game with both keyboard and xbox controller controls, but I'm having a little problem with the controller and with the simplest thing of all - jumping.

    First of all I disabled deafult jump controls in application properties so everything is controlled by events, then I set jumping two ways. First in MouseKeyboard, on key pressed condition, which works fine - when certain button is pressed sprite is jumping at a given height and when I press and hold the button the sprite will jump only once. When it comes to xbox controller there is a problem because it can only have one condition - on control is down, which makes that the sprite is flying up constantly when certain button is pressed and hold.

    So there is my question - is there any way to make xbox controller recognize only single button press even if the button is hold, like on key pressed condition?

    Here is screenshot of my events because I can't post link to .cap file yet

    <img src="http://i50.tinypic.com/23lmlwg.jpg" border="0" />

    Thanks in advance :)

  • 15 posts