Discuss Scratch

mysterious-neutron
Scratcher
1000+ posts

Bug in scrolling

I am making a among us themed scrolling game.

In that game I have 2 bugs:
  • First when we have a combination of 2 keys and touch the edge it goes out of the walls. Like this:



  • I also have code to stop the costume change when the key is released, but it doesn't work

    Link: https://turbowarp.org/463983738/
welcome_everyboy
Scratcher
48 posts

Bug in scrolling

see, your making your collition way too complicated, all you have to do to get perfect collition it this
in the level sprite:

when green flag clicked
forever
if <key [up arrow v] pressed?> then
change y by (-10)
if <touching [player v] ?> then
change y by (10)
end
end
if <key [down arrow v] pressed?> then
change y by (10)
if <touching [player v] ?> then
change y by (-10)
end
end
if <key [left arrow v] pressed?> then
change x by (10)
if <touching [player v] ?> then
change x by (-10)
end
end
if <key [right arrow v] pressed?> then
change x by (-10)
if <touching [player v] ?> then
change x by (10)
end
end
end

all that doese is it moves the level, but if the level is touching the player, then it moves backward
staiker1O9
Scratcher
100+ posts

Bug in scrolling

mysterious-neutron wrote:

I am making a among us themed scrolling game.

In that game I have 2 bugs:
  • First when we have a combination of 2 keys and touch the edge it goes out of the walls. Like this:



  • I also have code to stop the costume change when the key is released, but it doesn't work

    Link: https://turbowarp.org/463983738/
  • If there other guys solution doesn't, you could try my solutions which might kinda messy and janky, what I would do is to make a separate sprite for the bottom portion of the map or make it check for the y axis, then if it reaches that y, or touches said sprite, a custom block (because if you mke it custom you can make it run without screen refresh) will reset the plays y axis to be just standing on the platform
mysterious-neutron
Scratcher
1000+ posts

Bug in scrolling

welcome_everyboy wrote:

see, your making your collition way too complicated, all you have to do to get perfect collition it this
in the level sprite:

when green flag clicked
forever
if <key [up arrow v] pressed?> then
change y by (-10)
if <touching [player v] ?> then
change y by (10)
end
end
if <key [down arrow v] pressed?> then
change y by (10)
if <touching [player v] ?> then
change y by (-10)
end
end
if <key [left arrow v] pressed?> then
change x by (10)
if <touching [player v] ?> then
change x by (-10)
end
end
if <key [right arrow v] pressed?> then
change x by (-10)
if <touching [player v] ?> then
change x by (10)
end
end
end

all that does is it moves the level, but if the level is touching the player, then it moves backward
I can't use this. I have to add more things like enemies which need the variable for movement

staiker1O9 wrote:

mysterious-neutron wrote:

I am making a among us themed scrolling game.

In that game I have 2 bugs:
  • First when we have a combination of 2 keys and touch the edge it goes out of the walls. Like this:



  • I also have code to stop the costume change when the key is released, but it doesn't work

    Link: https://turbowarp.org/463983738/
If there other guys solution doesn't, you could try my solutions which might kinda messy and janky, what I would do is to make a separate sprite for the bottom portion of the map or make it check for the y axis, then if it reaches that y, or touches said sprite, a custom block (because if you mke it custom you can make it run without screen refresh) will reset the plays y axis to be just standing on the platform
I'll try that
mysterious-neutron
Scratcher
1000+ posts

Bug in scrolling

staiker1O9 wrote:

mysterious-neutron wrote:

I am making a among us themed scrolling game.

In that game I have 2 bugs:
  • First when we have a combination of 2 keys and touch the edge it goes out of the walls. Like this:



  • I also have code to stop the costume change when the key is released, but it doesn't work

    Link: https://turbowarp.org/463983738/
  • If there other guys solution doesn't, you could try my solutions which might kinda messy and janky, what I would do is to make a separate sprite for the bottom portion of the map or make it check for the y axis, then if it reaches that y, or touches said sprite, a custom block (because if you mke it custom you can make it run without screen refresh) will reset the plays y axis to be just standing on the platform
  • That doesn't work'


    I figured it out but that gives one more bug. The map vibrates!

Last edited by mysterious-neutron (Dec. 16, 2020 08:06:19)

mysterious-neutron
Scratcher
1000+ posts

Bug in scrolling

bump
Ankit_Anmol
Scratcher
500+ posts

Bug in scrolling

mysterious-neutron wrote:

staiker1O9 wrote:

mysterious-neutron wrote:

I am making a among us themed scrolling game.

In that game I have 2 bugs:
  • First when we have a combination of 2 keys and touch the edge it goes out of the walls. Like this:



  • I also have code to stop the costume change when the key is released, but it doesn't work

    Link: https://turbowarp.org/463983738/
  • If there other guys solution doesn't, you could try my solutions which might kinda messy and janky, what I would do is to make a separate sprite for the bottom portion of the map or make it check for the y axis, then if it reaches that y, or touches said sprite, a custom block (because if you mke it custom you can make it run without screen refresh) will reset the plays y axis to be just standing on the platform
  • That doesn't work'


    I figured it out but that gives one more bug. The map vibrates!
  • put in customs block
mysterious-neutron
Scratcher
1000+ posts

Bug in scrolling

Ankit_Anmol wrote:

mysterious-neutron wrote:

staiker1O9 wrote:

mysterious-neutron wrote:

I am making a among us themed scrolling game.

In that game I have 2 bugs:
  • First when we have a combination of 2 keys and touch the edge it goes out of the walls. Like this:



  • I also have code to stop the costume change when the key is released, but it doesn't work

    Link: https://turbowarp.org/463983738/
  • If there other guys solution doesn't, you could try my solutions which might kinda messy and janky, what I would do is to make a separate sprite for the bottom portion of the map or make it check for the y axis, then if it reaches that y, or touches said sprite, a custom block (because if you mke it custom you can make it run without screen refresh) will reset the plays y axis to be just standing on the platform
  • That doesn't work'


    I figured it out but that gives one more bug. The map vibrates!
  • put in customs block
  • ????? which block??

Powered by DjangoBB