This is a read-only archive of the old Scratch 1.x Forums.
Try searching the current Scratch discussion forums.

#1 2007-06-01 15:38:00

mohlar
Scratcher
Registered: 2007-05-24
Posts: 100+

How to move from one side to the other & then start again - no bounce

OK. There will be a simple solution to this but I'm tired and getting muddled.

For the moment, I simply want a character to start just 'off screen' on the left, and to then appear and walk across the screen before vanishing 'off screen' on the right. Then, I shall be changing the background and will want the sprite to reappear on the left. In other words - a walking loop where, presumably, x is reset to something like -250. Imagine the idea of a narrator walking from one scene into the next and you'll get the idea,

I can see the edge-detection and bounce control, but that's not want I want.

Thinking about it, it's a shame the edge-detector control can't cope with more options other than 'bounce'.

Offline

 

#2 2007-06-01 15:51:15

weissjd
Scratcher
Registered: 2007-05-16
Posts: 64

Re: How to move from one side to the other & then start again - no bounce

You have a couple of options. There is an option under sensing for "Touching Edge" that allows you to do whatever you want when the sprite touches an edge. What you probably really want is to check for the sprite's x position. Something like this:

If x position > 240
set x to -240

Offline

 

#3 2007-06-01 16:40:33

mohlar
Scratcher
Registered: 2007-05-24
Posts: 100+

Re: How to move from one side to the other & then start again - no bounce

Thanks weissjd, those two options sound ideal.
I'll give them both a try as I learn the basic inner workings of Scratch.

Offline

 

#4 2007-06-01 18:23:17

Mayhem
Scratcher
Registered: 2007-05-26
Posts: 1000+

Re: How to move from one side to the other & then start again - no bounce

If you look at my version of Semaj's aeroplane game, you'll see that the enemy jets do pretty much exactly what you are looking for.


Web-spinning Spider:  http://scratch.mit.edu/projects/Mayhem/18456
3D Dungeon Adventure:  http://scratch.mit.edu/projects/Mayhem/23570
Starfighter X: http://scratch.mit.edu/projects/Mayhem/21825
Wandering Knight: http://scratch.mit.edu/projects/Mayhem/28484

Offline

 

#5 2007-06-02 01:44:54

mohlar
Scratcher
Registered: 2007-05-24
Posts: 100+

Re: How to move from one side to the other & then start again - no bounce

Thanks Mayhem. Having just searched out your gallery I realise that I've already tagged a lot of your projects as being worth studying and learning from. There's some really nice work there.

Offline

 

#6 2007-06-02 04:13:54

Mayhem
Scratcher
Registered: 2007-05-26
Posts: 1000+

Re: How to move from one side to the other & then start again - no bounce

Thanks - the stuff I submit is often "proof of concept" and so lacks polish, or will never be finished, but I generally try to explain exactly what I was trying to do and how I did it.

Anything I post can be freely canibalised or improved upon - a lot of it is posted specifically with that in mind.

Generally useful stuff for game makers
- shooting routines from:
___ "Semaj798s Aeroplane Game updated" (for shooting straight ahead)
___ "Bow_and_arrow_Updated" (for shooting exactly at the mouse location)
___ "Bow_and_arrow_no_glide" (for shooting in the direction of the mouse location"
- The (crudely) animated archer in "Bow_and_arrow_with_archer"
- perspective routine in Marching Cyberman

Things I am especially pleased with:
- The enemy targeting routine in "Urban Tank Battle v2"
- The method of painting dots in  "Pacman experiment v2"
_____(*much* easier than using sprites, anyone planning a pacman of their ownshould really take a look)
- The change of direction of the arrow in "Archery"
- The "view circuit diagram" costume change in Simple Circuit v1

Last edited by Mayhem (2007-06-02 04:19:28)


Web-spinning Spider:  http://scratch.mit.edu/projects/Mayhem/18456
3D Dungeon Adventure:  http://scratch.mit.edu/projects/Mayhem/23570
Starfighter X: http://scratch.mit.edu/projects/Mayhem/21825
Wandering Knight: http://scratch.mit.edu/projects/Mayhem/28484

Offline

 

Board footer