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

#1 2012-04-24 16:50:01

hydreigon
New Scratcher
Registered: 2011-07-20
Posts: 23

Positionx / Positiony help!

Hello, my name is Hydreigon and I have been working on a very long and tiring project. It is a scrolling platformer game called Steve in Space. I have got to a point in which I wish to make bullets move, however stick with the scrolling sequence in the game. In the past I had made something like this called postitionx and positiony, however the old game got corrupted.  sad

Thanks in advance.

Offline

 

#2 2012-04-24 22:30:31

jji7skyline
Scratcher
Registered: 2010-03-08
Posts: 1000+

Re: Positionx / Positiony help!

So what do you want help with?


I don't know why you say goodbye, I say hello!  big_smile

Offline

 

#3 2012-04-25 02:45:53

hydreigon
New Scratcher
Registered: 2011-07-20
Posts: 23

Re: Positionx / Positiony help!

Basically when the alien shoots in the game, he will shoot a blue glowing bullet. However the bullet is supposed to move while scrolling, so that if you jump the bullet doesn't jump with you.  smile

Offline

 

#4 2012-04-25 11:14:27

zammer990
Scratcher
Registered: 2012-01-22
Posts: 500+

Re: Positionx / Positiony help!

I recently created a script that did exactly this (to an extent)
basically just have the bullet move the opposite direction you would when you press wasd or the arrow keys(whatever you use to move)


http://i45.tinypic.com/2ynq7nn.jpg Play now!

Offline

 

#5 2012-04-25 11:47:10

LS97
Scratcher
Registered: 2009-06-14
Posts: 1000+

Re: Positionx / Positiony help!

First of all you should pretend the bullet is part of the scenery -- so that the scripts that control its movement are exactly the same as those in one of your terrain.

Of course this will make the bullet stick to the scenery. Therefore you must make two new variables "for this sprite only" called xposition and yposition. You need to then modify the original movement script and add xposition to the X scroll and yposition to the Y scroll of that particular sprite.

Now you can control the position of the bullet using xposition and yposition as if they were the real (x position) and (y position) blocks, but the bullet will move relatively to the scenery  smile

If that didn't make sense, I'll try to re-explain.

Offline

 

#6 2012-04-25 15:24:27

hydreigon
New Scratcher
Registered: 2011-07-20
Posts: 23

Re: Positionx / Positiony help!

Thanks guys, but I just came up with a method. The alien that shoots the bullet has a position tracker that will note the aliens position every 0.01 seconds, then fire the bullet using xposition and yposition.  smile

Offline

 

Board footer