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.
whenclicked
foreversetm_x ▼tomouse xsetm_y ▼tomouse ysetx ▼tox positionsety ▼toy positionsetd ▼todistance to/mouse-pointer ▼5point towardsmouse-pointer ▼movedstepsiftouchingwall ▼?go to x:xy:yelsesetx ▼tox positionsety ▼toy positionmovedstepsiftouchingwall ▼?go to x:xy:yelsesetx ▼tox positionsety ▼toy positionmovedstepsiftouchingwall ▼?go to x:xy:yelsesetx ▼tox positionsety ▼toy positionmovedstepsiftouchingwall ▼?go to x:xy:yelsesetx ▼tox positionsety ▼toy positionmovedstepsiftouchingwall ▼?go to x:xy:y
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.
Edit: oops, it appears to be glitching when I try it, and I won't have any time to fix it today. Sorry guys.whenclicked
foreversetd ▼todistance to/mouse-pointer ▼length of spritepoint towardsmouse-pointer ▼setbool ▼tofalsesetx ▼tox positionsety ▼toy positionrepeat untilordistance to<mouse-pointer ▼length of spritebool=truemovedstepsiftouchingwall ▼?go to x:xy:ysetbool ▼totrueelsesetx ▼tox positionsety ▼toy positionifbool=falsego tomouse-pointer ▼iftouchingwall ▼?go to x:xy:y
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.
whenclicked
forever ifdistance to>mouse-pointer ▼length/2point towardsmouse-pointer ▼movelengthstepsiftouchingwall ▼?movesteps+-1*length2iftouchingwall ▼?move-2steps
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