How to do this calculation

0 favourites
  • 11 posts
  • Hello, I have a sprite that moves in a scroll, there is a problem, if I direct the sprite down, then it is as if the sprite is stopped, since it advances at the same speed of the scroll.

    I want to move the sprite in the right way, it's a bit confusing to explain.

    Just run the capx and move the sprite down, then you will see that the sprite and the scroll move at the same speed and it seems that the sprite has simply stopped, that is the problem.

    I must find the way for the sprite to advance in the correct way.

    Do you understand what I mean?.

    Just move the mouse so the sprite follows it.

    https://dl.dropboxusercontent.com/u/60803633/testVelocidad.capx

  • A plugin dependencies prevent me to open the file. Easy access to open your file will make people willingly to help.

  • A plugin dependencies prevent me to open the file. Easy access to open your file will make people willingly to help.

    Hi, sorry I've already fixed it.

    Sine is your only friend.

    https://www.dropbox.com/s/7w8v77qo85v2s ... .capx?dl=0

    I see, you have made a calculation, although at the moment I do not understand correctly but ...

    It looks like it's moving faster downwards now to than up, right?

    I mean, the velocity to the bottom zone is greater than the upward velocity ?.

  • Just double.

    Adjust this way

    velSprite + ( ( ((1 + (sin (4ngle)))) / 2) * velTilemap)

    Where velTilemap is the speed of the tilemap. Or, experiment with it to your liking.

    Up will be always velSprite.

  • Scrolling up supposed to has impression that player moving upward. Assume that the sprite player is a bus. So it won't make sense when the bus stop mean while the background still moving (scrolling). Try to put static object to get how the movement feeling is. In SHMUP case the only reason main ship moving down is slowing down the speed and not completely stop.

  • Scrolling up supposed to has impression that player moving upward. Assume that the sprite player is a bus. So it won't make sense when the bus stop mean while the background still moving (scrolling). Try to put static object to get how the movement feeling is. In SHMUP case the only reason main ship moving down is slowing down the speed and not completely stop.

    Oh i agree. When 'not moving' it should still act as it is pinned to the background.

    But that brings 1 little annoying problem.

    He/she moves 'the bus' toward the mouse/touch position. That is of course perfectly legit.

    But, and that is the problem, the mouse/touch should also act 'as pinned to the background'.

    And i have no darn idea how to accomplish that !

  • Let's make the bus front headed down. Now we have front part of the bus heads down which is make the rear heads up mean while the background still scrolling up. We get our bus moving backwards! After all it's all about relative position and how we dealing or make use with it.

  • Let's make the bus front headed down. Now we have front part of the bus heads down which is make the rear heads up mean while the background still scrolling up. We get our bus moving backwards! After all it's all about relative position and how we dealing or make use with it.

    Cant do, says the devil on my right shoulder, that will change angle and/or distance towards the mouse/touch, and therefor make 'the bus' move.

    Perfectly possible when using 8directions, or probably any other way that i can think off, just not when steering towards the mouse/touch. (i think ... means i am in doubt, means i dont see how)

    Hey ? I am not arguing, not seeking you, not attacking, not interested in my own wrong or right. Rather seeking dialog.

  • No I just play the scenario from current capx events exactly as it is. Probably unwanted one and would ruin entire gameplay. But I'll wait the Mnk reply to understand what kind of gameplay He would like to achieve.

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • Hello, first of all thanks, as soon as I can modify the example so that it becomes clearer what I want to achieve but we are on the right track.

Jump to:
Active Users
There are 1 visitors browsing this topic (0 users and 1 guests)