laser314 wrote:
amcerbu wrote:
Well, if Scratch had greater computational speed (in other words, no built-in delay), I would use a recursive function, but unfortunately, loops are slow.
I don't think turbo mode has the delay.
That's correct, but making programs for turbo mode is harder; I've been experimenting with it on my test account, but you have to implement a feature that keeps the framerate constant. This restricts your programming: no "glide" blocks, no "wait _ secs" blocks, and no "play _ until done" blocks. I don't think Firedrake969 wants to build a project suited only for turbo anyway.
Offline
lalala3 wrote:
The problem is that you made it move away from the mouse, not the wall.
Randomness_Player wrote:
Did you use color sensing or sprite sensing?
Try using sprite sensing as the wall...
lalala3 is quite right... because the mouse pointer is black... and you might have used color sensing.
The problem is nothing like that.
Offline
EPICPIKAGUY wrote:
EPICPIKAGUY wrote:
fetzer wrote:
Ya, i might also suggest making the wall a bit thicker?
Yep,that is a great idea,but what if u wanna make a wall thin?first you have to make a maximum velocity(your caracter cannot go faster than a certain speed),then make your sensor as thick as your maximum velocity(e.g. Max vel. Equals 5,u make sensor 5 pixels(if u don't know that measure,just estimate)).
No offense,of corse!
The wall thickness is NOT the problem.
Offline
MoreGamesNow wrote:
This script should work "better". Increasing the number of trials (increase "5" and the if-else statements) will make it "better", but at the cost of speed. I don't want to guess whether it will fit into a single frame, but, at the very least, the script should show the basic concept.
when gf clicked forever set [m_x v] to (mouse x) set [m_y v] to (mouse y) set [x v] to (x position) set [y v] to (y position) set [d v] to ((distance to [mouse-pointer v])/(5)) point towards [mouse-pointer v] move (d) steps if<touching [wall v]?> go to x:(x) y:(y) else set [x v] to (x position) set [y v] to (y position) move (d) steps if<touching [wall v]?> go to x:(x) y:(y) else set [x v] to (x position) set [y v] to (y position) move (d) steps if<touching [wall v]?> go to x:(x) y:(y) else set [x v] to (x position) set [y v] to (y position) move (d) steps if<touching [wall v]?> go to x:(x) y:(y) else set [x v] to (x position) set [y v] to (y position) move (d) steps if<touching [wall v]?> go to x:(x) y:(y) end end end end end
it should work with only one if/else block
Offline
wahoo77 wrote:
it should work with only one if/else block
That may be possible, but would definitely be difficult. I've simplified the script though.
when gf clicked forever set [d v] to ((distance to [mouse-pointer v])/(length of sprite)) point towards [mouse-pointer v] set[bool v] to [false] set [x v] to (x position) set [y v] to (y position) repeat until <<(distance to [mouse-pointer v]) < (length of sprite)> or <(bool) = [true] >> move (d) steps if<touching [wall v]?> go to x:(x) y:(y) set [bool v] to [true] else set [x v] to (x position) set [y v] to (y position) end end if<(bool) = [false]> go to [mouse-pointer v] if <touching [wall v]?> go to x:(x) y:(y) end endEdit: oops, it appears to be glitching when I try it, and I won't have any time to fix it today. Sorry guys.
Last edited by MoreGamesNow (2012-06-18 08:15:28)
Offline
Okay, this solution is relatively simple (and works) but essentially just makes the sprite move towards the sprite at a fairly high speed. You can just replace "length" with a constant number (the minimum distance between two opposite points on a sprite). For instance, a 16x16 pixel square would have a length of 16.
when gf clicked forever if <(distance to [mouse-pointer v]) > ((length)/(2))> point towards [mouse-pointer v] move (length) steps if <touching [wall v]?> move (((-1)*(length))+(2)) steps if <touching [wall v]?> move (-2) steps end end
Offline
Yes, but if you move your mouse too fast it will appear to "follow" it rather than "go to" it.
Edit: you should also click the square that prevents the sprite from rotating.
Last edited by MoreGamesNow (2012-06-20 19:18:04)
Offline
Make sure it moves back a greater distance than it moves forward. Also, make sure it checks for walls as often as it checks for movement keys pressed. I hope this helped! (:
Offline
Ok. I've been offline for a few days. Let me catch up on everything.
Offline
You would need to go into color sensing and velocity, which is a whole nother topic.
If you come look at my game, Frigate, you'll see what color sensing+velocity is.
Download and look at one of the character sprites. Basically, we have velocity, and we have another costume with colors on each side of the sprite. Then, when the script runs, it detects to see if any of the colors are touching a wall. If it is, then the script tells the velocity variables to reverse direction and bounces the sprite back.
If my script is too confusing, I'll write up a simplified one.
Offline
fg123 wrote:
You would need to go into color sensing and velocity, which is a whole nother topic.
I'm pretty sure you don't need color sensing.
Offline