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

#1 2009-01-05 18:14:34

TheSaint
Scratcher
Registered: 2008-11-04
Posts: 1000+

Using Lists to Record positions using Scroll

I need help comeing up with a code to use lists to record the position of an object while in scrolling. I need it for the enemys in a mario kart game if that clarifies anything. Please help!

Offline

 

#2 2009-01-05 18:20:47

archmage
Scratcher
Registered: 2007-05-18
Posts: 1000+

Re: Using Lists to Record positions using Scroll

Give your sprites an xpostion variable and a yposition variable

Record the values of these variables and move them move like this

go to x:xposition+scrollX y:yposition+scrollY


Hi, I am Archmage coder extraordinaire. I do Scratch,pascal,java,php,html, AS2 and AS3. Leave me a message if you want coding advice. Also check out my personal website, lots of good stuff about web development, Flash, and Scratch (v1 and v2) !

Offline

 

#3 2009-01-05 18:26:18

Zelda123
Scratcher
Registered: 2007-11-21
Posts: 1000+

Re: Using Lists to Record positions using Scroll

Do you mean like this:
http://scratch.mit.edu/projects/Zelda123/266182

Offline

 

#4 2009-01-05 20:14:33

TheSaint
Scratcher
Registered: 2008-11-04
Posts: 1000+

Re: Using Lists to Record positions using Scroll

Zelda123 wrote:

Do you mean like this:
http://scratch.mit.edu/projects/Zelda123/266182

NOt quite. What I want is if yourare that one cat and then when you press the down key, another cat pops up and does the replay.

Offline

 

#5 2009-01-06 13:42:25

TheSaint
Scratcher
Registered: 2008-11-04
Posts: 1000+

Re: Using Lists to Record positions using Scroll

Anyone? Archmage, how would I get those positions in the first place?

Offline

 

#6 2009-01-06 14:07:28

archmage
Scratcher
Registered: 2007-05-18
Posts: 1000+

Re: Using Lists to Record positions using Scroll

TheSaint wrote:

Anyone? Archmage, how would I get those positions in the first place?

Just move the karts your self and record it.

The essential part is how you move the karts.

Move your cars with the code above. My ghost driver project is a good example of this.


Hi, I am Archmage coder extraordinaire. I do Scratch,pascal,java,php,html, AS2 and AS3. Leave me a message if you want coding advice. Also check out my personal website, lots of good stuff about web development, Flash, and Scratch (v1 and v2) !

Offline

 

#7 2009-01-06 15:19:10

archmage
Scratcher
Registered: 2007-05-18
Posts: 1000+

Re: Using Lists to Record positions using Scroll

TheSaint wrote:

Maybe I didn't explain it right or something because what you told doesn't work.
The scrolling starts at X 660 and Y -190. The kart postition on the screen never changes from X 4 Y 51.  I cannot do it like you ghost driver because I use different sppeds and formulas if it bounces off walls or flies out into space. Is there any way to record the positions in the scroll and then replay them so it follows the exact course I first drove it in?

Ok, so your issue is that you want to record ghost karts but when you record the karts you want it to play back properly.

You can still use my ghost driver thing. Take a look at the code. All it does is record when buttons you press. Just replace your movements codes for the car with your own and record your buttons presses.

You can also do positions which works equally well.

Last edited by archmage (2009-01-06 15:19:52)


Hi, I am Archmage coder extraordinaire. I do Scratch,pascal,java,php,html, AS2 and AS3. Leave me a message if you want coding advice. Also check out my personal website, lots of good stuff about web development, Flash, and Scratch (v1 and v2) !

Offline

 

#8 2009-01-06 15:22:21

TheSaint
Scratcher
Registered: 2008-11-04
Posts: 1000+

Re: Using Lists to Record positions using Scroll

archmage wrote:

TheSaint wrote:

Maybe I didn't explain it right or something because what you told doesn't work.
The scrolling starts at X 660 and Y -190. The kart postition on the screen never changes from X 4 Y 51.  I cannot do it like you ghost driver because I use different sppeds and formulas if it bounces off walls or flies out into space. Is there any way to record the positions in the scroll and then replay them so it follows the exact course I first drove it in?

Ok, so your issue is that you want to record ghost karts but when you record the karts you want it to play back properly.

You can still use my ghost driver thing. Take a look at the code. All it does is record when buttons you press. Just replace your movements codes for the car with your own and record your buttons presses.

You can also do positions which works equally well.

Oops, I just got it working after I posted that. Thanks for all of the help!

Offline

 

#9 2009-01-07 11:56:57

Lucario621
Community Moderator
Registered: 2007-10-03
Posts: 1000+

Re: Using Lists to Record positions using Scroll

TheSaint wrote:

Zelda123 wrote:

Do you mean like this:
http://scratch.mit.edu/projects/Zelda123/266182

NOt quite. What I want is if yourare that one cat and then when you press the down key, another cat pops up and does the replay.

Like a ghost in time trial?


http://i.imgur.com/WBkM2QQ.png

Offline

 

#10 2009-01-07 16:21:26

TheSaint
Scratcher
Registered: 2008-11-04
Posts: 1000+

Re: Using Lists to Record positions using Scroll

Lucario621 wrote:

TheSaint wrote:

Zelda123 wrote:

Do you mean like this:
http://scratch.mit.edu/projects/Zelda123/266182

NOt quite. What I want is if yourare that one cat and then when you press the down key, another cat pops up and does the replay.

Like a ghost in time trial?

Actually yeah. I got it to work just abslutly fine on my computer and then what does it do? It doesn't work online! The menu system doesn't work. Anyways I will try to fix it and get it posted.

Offline

 

Board footer