randomly's Recent Forum Activity

  • Thanks so much everyone for your responses!

    I took a look at 99Instances2Go 's and 's capxs. I figured, I'd just add the "rotate to" action to my project, because that looks like the easiest and shortest version to me (I'm a lazy person). Thanks for your suggestion!

    This is solved, thanks again!

    (I hope I don't disappoint those who created a capx, I opened them and read through it, I just think that it's less work to just optimize my existing project. Thank you anyways for taking the time to deal with my problem. :) I wish there was a thanks button on this forum...)

  • Hey Donkeykong12

    I think I start to grasp your idea...

    So the left key controls the left rotor of the helicopter and the right key controls the right rotor?

    So the longer you hold the key, the higher the throttle of the rotor?

    And when you press both keys at the same time, the helicopter will just go straight upwards?

    If that's what you're going for, I'll try to setup a little capx to show you how to do it. (If I'm actually able to do it, but it should work).

  • Well that's why I asked.

    Because I'm still learning and the angle doesn't seem to be very smooth when the mouse is moving smoothly.

    If that's the best solution possible, then I'm fine with that. :)

    Well, maybe there is a better solution for the stuff before the angle() stuff...

  • Hey,

    what exactly do you want to do? Do you want to generate levels randomly?

    Or do you want to create the levels by yourself and include them in layouts?

    Give us some further information please.

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • First of all, how do you access the Internet in your game? Via AJAX?

    And did you add a "touch" object to your project?

    We will need some further info to help you.

  • Hey,

    we can't tell that from just your post.

    We need a capx or at least a screenshot of your current project/"on tap" event.

  • Hey y'all,

    I recently needed the angle of the mouse's movement in one of my projects.

    Essentially, I need the angle in which the user moves the mouse, e.g. for a duration of 0.2 seconds.

    My idea to solve this:

    I came up with the idea to create global variables which store the Mouse.X and Mouse.Y and get refreshed every 0.2 seconds (let's call them "LastKnownX" and "LastKnownY").

    As soon as either of those variables doesn't correspond with the current Mouse's position, the angle of movement is calculated via

    angle(LastKnownX,LastKnownY,Mouse.X,Mouse.Y)[/code:1u2ycl63]
    
    This works okay, isn't very smooth though.
    
    My question now is:
    [b]Is there a better (more effective) way of doing this?[/b]
    
    Thanks for any help.
    _____________________________
    .capx of my setup: https://www.dropbox.com/s/8gkhpl7smf2eh36/MouseAngle.capx?dl=1
    image of my current setup: http://i.imgur.com/3wtATXJ.png
  • Well, of course that is possible.

    If I understood you correctly, you have a single sprite which will go up and rotate clockwise when you hold the left key and go down and rotate counter-clockwise when you hold the right key?

    I'm a bit confused what your goal is because your thread's title sounds different to what you describe...

    I will just guess now that you want the sprite to move in the direction it is facing?

    So it does a curve when you hold either key?

    Well, if I understand you correctly, this is what you gotta do:

    • add the "Keyboard" object
    • add two "key pressed" conditions, one for the left and one for the right key.

    the actions in the "key pressed" condition for the left key would look like this:

    - Sprite: set angle to: "Self.Angle+?"
    [ul]
    	[li]Sprite: move forward: ?[/code:f76tkgc4][/li]
    [/ul]For the right key, it would be the same, just "Self.Angle[b]-[/b]?".
    
    Replace the ? with a degree of your favour for the Angle and a pixelamount of your favour, for the movement.
    The higher the value, the faster.
  • R0J0hound

    Thanks so much for answer!

    This works perfectly for predicting the impact while flying!

    The thing is, I want to predict the impact before launching. That means, since the initial speed and gravity are known, I could predict the impact x coordinate, right?

    I just need the right formula for that...

    As I said, your formula works perfectly for predicting the impact when the bullet is flying.

    I don't think though, that I can predict the impact point before the actual launch.

    The reason might be that the angle of motion can't be predicted in the formula for the process of flying.

    Maybe I'm really not grasping something here, or my idea isn't even possible.

    Thanks for your continuous dedication for my problem, I hope I'm clear enough about what my goal is here.

  • Hey baokinh ,

    I assembled a little capx over night in case you get stuck.

    It's nor perfect nor complete but I guess it showcases the two version pretty good.

    Have fun.

    Download:

    dropbox.com/s/58mxrdak8cxe9e3/TappingSpeed.capx

  • I'll see whether I can create a capx at some point including the two methods.

    Though there is this thing calles...private life, which keeps me from doing it.

    Goddamnit.

    Same here as for , I'll see when I have time, I'll go for it.

    But maybe those two solutions are enough initial thrust for you to launch your mind and get your project done.. ;)

  • baokinh

    Well, there are some possible ways you could go.

    The easiest one would be to have a global or instance variable, e.g. "speed", initial value = 0

    Your character would be moved horizontally based on the value of "speed".

    In detail, this means:

    • each time you tap, the value gets increased by a specific (and small) amount.
    • every x seconds or every tick (depending on your preference), the character gets moved +speed pixels on the horizontal axis

    (the faster you tap, the further the character goes)

    • every x seconds or every tick (again, depending on your preference), the "speed"-value gets decreased by a specific amount, causing the character to go backwards when the value is under zero.

    (To prevent the character going off-screen, you would have to clamp his x coordinate)

    The exact amounts and timings depend on your likings.

    This is the basic principle, I would go with. It seems the simplest to me.

    _________________

    If I wasn't clear enough, I can try to create an example project for you.

randomly's avatar

randomly

Member since 26 Sep, 2016

Twitter
randomly has 1 followers

Trophy Case

  • 8-Year Club
  • Email Verified

Progress

9/44
How to earn trophies