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

#1 2012-01-26 18:20:10

Happypieman
Scratcher
Registered: 2010-09-28
Posts: 100+

I've already hit a hard-spot.

So i'm making Spice Pirate right? I need some help, so, here goes.

It's an x and y scroller, but i need these things 'freighters' to move from one planet top another, while you are just moving around anywhere you want.

MORE IN DEPTH: So you can move around anywhere you want, shoot any ships you want, but meanwhile there is a gamewide trading system, with freighters going from one planet to another. I have thought of a way, but no. I thought that i could just make the freighters point towards (planet) and move there, but as you scroll, the planets move too, so this won't work. Any ideas??? I really want this to go ahead.


2012--The biggest troll ever.

Offline

 

#2 2012-01-26 18:26:06

Kileymeister
Scratcher
Registered: 2008-04-17
Posts: 1000+

Re: I've already hit a hard-spot.

So you need the freighters to move towards the planets, but stay relative to your own scrolling position?  There's an easy way.  Simply assign the freighters new variables called "ScrollXPosition" and "ScrollYPosition" and add a script like this:
http://img39.imageshack.us/img39/6850/script.gif

Now, instead of changing their X and Y positions, change their ScrollXPosition and and ScrollYPosition variables instead.  So if you wanted it to go to planets, you can do something like this:
http://img542.imageshack.us/img542/6850/script.gif
This serves as the equivalent of "point and move three steps" but in variable form.

So now in the end the freighters behave as though there is no scrolling at all, their true position is concrete, and you see where they would be relative to your own position.

If you need any other help let me know.

Also, I am loving this Help With Scripts section.  Very clear cut and to the point.

Last edited by Kileymeister (2012-01-26 18:33:55)


I'm back, and showcasing two new* projects!  Click left or right on the image below to see!
http://img109.imageshack.us/img109/7905/part1l.pnghttp://img859.imageshack.us/img859/6417/part2bf.png

Offline

 

#3 2012-01-26 18:41:40

Happypieman
Scratcher
Registered: 2010-09-28
Posts: 100+

Re: I've already hit a hard-spot.

Kileymeister wrote:

So you need the freighters to move towards the planets, but stay relative to your own scrolling position?  There's an easy way.  Simply assign the freighters new variables called "ScrollXPosition" and "ScrollYPosition" and add a script like this:
http://img39.imageshack.us/img39/6850/script.gif

Now, instead of changing their X and Y positions, change their ScrollXPosition and and ScrollYPosition variables instead.  So if you wanted it to go to planets, you can do something like this:
http://img542.imageshack.us/img542/6850/script.gif
This serves as the equivalent of "point and move three steps" but in variable form.

So now in the end the freighters behave as though there is no scrolling at all, their true position is concrete, and you see where they would be relative to your own position.

If you need any other help let me know.

Also, I am loving this Help With Scripts section.  Very clear cut and to the point.

wow, thanks!!! yeah, this section is definately going to be great.


2012--The biggest troll ever.

Offline

 

Board footer