I have a pacman game and the pacman moves fine - but whenever the enemy (it's a crab) moves into a wall, I can't get him to move again! Can anybody help me?
Offline
RosesandViolets wrote:
I have a pacman game and the pacman moves fine - but whenever the enemy (it's a crab) moves into a wall, I can't get him to move again! Can anybody help me?
Have you uploaded it to Scratch and if you have can you post a link?
Offline
I haven't because it is an edit of a basic one that I made which I can give you a URL for
http://scratch.mit.edu/projects/RosesandViolets/2843477
Offline
RosesandViolets wrote:
I haven't because it is an edit of a basic one that I made which I can give you a URL for
http://scratch.mit.edu/projects/RosesandViolets/2843477
Aha- I have spotted the problem. You have put "if colour is touching another colour" move so when it is not touching that colour and touching the wall colour it will not move!
I'm trying to find someway to fix this but the problem is your sprite is not moving at all in this version so I have to make it move and then sort out the problem
EDIT- by using the "if touching colour" block i have got it to move. Now then- problem fixing time
Last edited by Willpower (2012-10-20 11:15:20)
Offline
Okay, thank you
Offline
Excuse the awful scratchblocks- you get the idea.
when gf clicked forever if (touching <color pink>) move (Speed) steps if (touching (color purple)) turn <(180 degrees anti-clockwise)> move (Speed) steps endI have got this working!! If you want i could upload it to my test account and you can use it then i can. This Method would be to turn the sprite 180 degrees when it touches purple to make it go in the opposite direction
Last edited by Willpower (2012-10-20 11:31:33)
Offline
Thank You! It worked!
I'm really happy now
Offline
Willpower wrote:
Excuse the awful scratchblocks- you get the idea.
when gf clicked forever if (touching color [#f900ff]?) move (Speed) steps if (touching color [#8400ff]?) turn ccw (180) degrees move (Speed) steps end
Fixed.
Offline
ErnieParke wrote:
Willpower wrote:
Excuse the awful scratchblocks- you get the idea.
when gf clicked forever if (touching color [#f900ff]?) move (Speed) steps if (touching color [#8400ff]?) turn ccw (180) degrees move (Speed) steps endFixed.
Thanks Ernie!
Offline
Willpower wrote:
ErnieParke wrote:
Willpower wrote:
Excuse the awful scratchblocks- you get the idea.
when gf clicked forever if (touching color [#f900ff]?) move (Speed) steps if (touching color [#8400ff]?) turn ccw (180) degrees move (Speed) steps endFixed.
Thanks Ernie!
Your welcome!
Offline
you may also want to put an "if on edge, bounce" but to be honest, it really isn't necessary unless you wanted it to be more realistic to the laws of gravity...
Offline
I would do this.
when gf clicked forever move [1] steps if <key [up v] pressed?> set [direction v] to [1] end if <key [down v] pressed?> set [direction v] to [2] end if <key [left v] pressed?> set [direction v] to [3] end if <key [right v] pressed?> set [direction v] to [4] end if <((direction) = [1])> point in direction [0] end if <((direction) = [2])> point in direction [180] end if <((direction) = [3])> point in direction [-90] end if <((direction) = [4])> point in direction [90] end end
Offline
Ideas wrote:
I would do this.
when gf clicked forever move [1] steps if <key [up v] pressed?> set [direction v] to [1] end if <key [down v] pressed?> set [direction v] to [2] end if <key [left v] pressed?> set [direction v] to [3] end if <key [right v] pressed?> set [direction v] to [4] end if <(direction) = (1)> point in direction [0 v] end if <(direction) = (2)> point in direction [180 v] end if <(direction) = (3)> point in direction [-90 v] end if <(direction) = (4)> point in direction [90 v] end
Fixed.
Offline