Movement problems

GoliBroda

Member
Hey.
I have swipe controlls and i don't know why it thinking that i keeps swiping down.
Lets start from the begining.
So i have script that gathers the swipe direction.
And the swipe direction is converted to a move by this code.

Convert direction code:
Code:
//Up
if ((direction > 45) && (direction <=135))
{
    up_true = 1;
    direction = 1000
}
up_true = 1 because of the next script
direction = 1000 is because i want to stop after one step

Then i got this code to make moves
Code:
  ///go up
if (up_true = 1){
up_true = 0
<the movement code here>
}
Both codes are in step event.
The thing is this is working, when i swipe up my character walks up, i have same codes also for right and left and it is working well (only when code for converting swipe down is deleted)
When i paste the convert direction code for moving down, this code:
Code:
if ((direction > 225) && (direction <315))
{
    direction = 1000
    down_true = 1;
}
My character is walking backward non stop, when i delete this code this isnt happens. That's wierd because this code is same for up, right and left.
The best part is i also have an button press event for each dir and in these events i have codes like:
Code:
down_true = 1
And when the converting code for down (only for down) movement isnt pasted the controlls works well (i mean the swiping (up, right, left) and the keyboard buttons (in each direction, even for down)

Why the hell this isnt working?
 
Last edited:

NightFrost

Member
The structure of the code you posted doesn't seem to have anything inherently wrong, but the
Code:
if (up_true = 1){
is not a comparison, you are setting up_true to the value of 1 here. Similar problems elsewhere in your code may be the cause of constant downward movement, or it might be something as simple as you omitting to set down_true to zero when the movement code block executes. We would need to see more of your code.
 

GoliBroda

Member
can i do something like this??
if <directions are good>{
press down key
}
That would help me a bit.
 
Last edited:

GoliBroda

Member
pls, i need this

i got swipe controlls code from here:
https://marketplace.yoyogames.com/assets/416/swipe-controls
maybe this will help you.

New fact, i added new execute code to the same step event and pasted
if (down_true = 1){
down_true = 0
}
there.
My character isnt keep going down but when i swipe down also don't moving.
(when i press down key it works fine)

What a mind💩💩💩💩
How it can be possible!!!!
Pressing down key = down_true 1
swiping down = down_true 1
Both actions do the same, so how the fu*k one of them can broke my game and other not?!!?
 
Last edited:

GoliBroda

Member
If i change the 1000 to -1000

Code:
//Down
if ((direction > 225) && (direction <315))
{
    direction = -1000
    down_true = 1;
}
Character is no more going down but also wont go down when i swipe down.

This is sick

I am mad!!
Everything seems to bee good but it still not working!
 
Last edited:
Top