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

#1 2009-10-07 07:42:58

Kokan
Scratcher
Registered: 2009-10-06
Posts: 9

Quite a few questions....

Hello, I recently started playing around with scratch. At the moment I am trying to make a simple tank shooter/collecting.....points game? I have only made movements but I have already run into some probelems. They are :

1- Making the tanks wrap? around the screen. Like the game 'Asteriods' when going from the left side and reappearing in the right as you move off screen.

2- Having my tanks shoot some kind of projectile to attack the second player tank.

3- Some kind of extra momentum on the player. If the are moving, they continue to do so even when the keys are released for a second or so.

4-Whenever the 'Treasure' is collected to get extra points it dissapears and does not come back. Would I have to make some kind of 'Random Place' Variable  and create a variety of co-ordinates for it to be used with the operator.  Just figured this problem out

I have tried playing around with Variables but I am find it a bit difficult understanding it at the moment and have only just made a score system when you collect points when picking points up ^^;; Would the 'Scratch: Programming for Teens' be able to help me out with the creation of more complex projects. I have read mixed reviews about the book from 'not helpful to beginners' 'content is lacking' to 'A must have for beginners.

Thank you for your time and any help would be greatly appreaciated.

Last edited by Kokan (2009-10-07 08:13:05)

Offline

 

#2 2009-10-07 09:05:30

steppenwulf
Scratcher
Registered: 2009-07-23
Posts: 1000+

Re: Quite a few questions....

Your already using variables, good job! I think I can help you Kokan. I can't test these scripts myself atm so I will tryto do my best.

1. To make your tank shoot, first make a seperate sprite for the bullet. Apply the below scripts to the bullet:

<when green flag clicked>
<go to[ whatever sprite your tank is
<hide>

<forever if><key[ space ]pressed?>
<repeat until><touching[ edge
<show>
<move( 10 )steps>
<end>
<hide>
<go to[ whatever sprite your tank is

2. We call that extra momentum, velocity.  I have a tutorial on velocity, and you can download the script and put it in your game.

3. As to the book, I've never even heard of it. I learned Scratch simply through practice and asking questions.  smile

4. I'm not sure how to warp. I could probably figure it out in my head, but someone will probably post by then.  lol   (I really use too many smileys lol)

Last edited by steppenwulf (2009-10-07 09:08:28)


I'm graduating HS this April and going to college in the Fall.

Offline

 

#3 2009-10-08 14:28:33

Kokan
Scratcher
Registered: 2009-10-06
Posts: 9

Re: Quite a few questions....

Thanks for your velocity tutorial is has helped a lot!

Adding these functions has again created some problems with my overall game. Can anyone answer questions regarding the projectiles, and changing direction with velocity.

1. I have used the script for the bullet and something does fire out. But it only ever comes from the one direction. I plan on having it shoot from the from of the tank sprite.  No matter how I position my tank. Would I have to attach a sprite onto my tank sprite and aim it somehow in the front direction?

2. The velocity movement has worked. But the directional input is not the same as it was without velocity. Orginally I had the tank being able to turn in directions and move at the same time. But now with the velocity it does not move in the direction it's pointing to. Instead the sprite turns to a diffrent direction but continues to move in the same direction.

Sorry for the long post, and again any help would be great.

Thanks.

Last edited by Kokan (2009-10-08 14:40:14)

Offline

 

#4 2009-10-08 16:06:08

Ssbrawl700
Scratcher
Registered: 2009-02-11
Posts: 100+

Re: Quite a few questions....

I think you should post up what you have so far so we can see the scripts and help you better.


Can you beat the ever-so challenging Keyboard Khaos?

Offline

 

#5 2009-10-08 17:57:11

Locomule
Scratcher
Registered: 2009-08-24
Posts: 500+

Re: Quite a few questions....

As for wrapping the tanks, here are my thoughts...
When moving a sprite off the Scratch screen, it will not go completely off before it disappears. If these blinking edges do not bother you (or you could fit everything else to them I guess) then all you have to do is set your tanks so that when they move so far left or right, they hide, move to 480 pixels the other way, show, and continue moving.

As for sprites not going completely off the stage before disappearing, I figured out that regardless of the sprite's size, it will disappearing when it has less than 18 pixels showing on the edge of the stage. So I made a border sprite that goes around the screen and covers up the "blinking" gap. You can see it here... ps. the cat would be representative of your tank. Although it doesn't move, except briefly to run away from you, it will wrap around the screen. Much more obvious is the scrolling background. It is made of 4 sprites that all seam together. They are all 480x360. When one of them goes off the side, it immediately goes to the other. This is what gives my floor the scrolling effect. Is based on the scrollx routine but I'm guessing you could do with a far simpler version.

http://scratch.mit.edu/projects/Locomule/707613


aka Pain from DragonSpires, Delrith Online, BotBattle, Urban Dead etc etc lol

Offline

 

#6 2009-10-08 17:58:21

Locomule
Scratcher
Registered: 2009-08-24
Posts: 500+

Re: Quite a few questions....

My bad, I see now that this is exactly what you need! For more info, look for scrollx.

Just remembered this...
http://archblogger.wordpress.com/2008/11/06/make-a-game-like-super-mario-world-demo/

which I got from here...
http://scratch.mit.edu/forums/viewtopic.php?pid=183064#p183064


heh, I'm just gonna start posting that link as my answer to everything! j/k  tongue

Last edited by Locomule (2009-10-08 18:01:27)


aka Pain from DragonSpires, Delrith Online, BotBattle, Urban Dead etc etc lol

Offline

 

#7 2009-10-09 06:21:42

Kokan
Scratcher
Registered: 2009-10-06
Posts: 9

Re: Quite a few questions....

http://i80.photobucket.com/albums/j175/nonoon/BulletSprite.png
This is the bullet sprite I am using. Bullets do come out but at a awkard directions that I do not have control over.

http://i80.photobucket.com/albums/j175/nonoon/FirstMovementSprite-1.png
This was the first movement I used for my tanks, this is currently still the blocks for second player which is working perfectly fine. I am using it as a comparison for Sprite 1.

http://i80.photobucket.com/albums/j175/nonoon/SpriteVelocity.png
For first player I have the velocity attempt. I'm not sure how to add the ability to turn and move forward and back in the pointed direction.


Thanks for anyone taking the time to look.

Last edited by Kokan (2009-10-09 06:22:04)

Offline

 

#8 2009-10-09 17:19:24

Locomule
Scratcher
Registered: 2009-08-24
Posts: 500+

Re: Quite a few questions....

I see your "Score" variable, good job. Lets go through what you posted one block at a time...

Block 1- (of your post)- These bullets are auto-aiming cause you coded them to
[blocks]<point in direction( Sprite 1[/blocks]
You could make an Aim variable. When a bullet is fired, set Aim to the same value as the tanks Direction. Then set the bullets direction to match Aim. No more heat-seeking bullets!

Block 2-  Looks pretty good. Make the tanks turn 9 (or any factor of 90) degrees instead of 7 so that they will always be able to shoot straight up, down, left and right. At 7 degrees, they will gradually point at weird angles. Also, you will want to move the "if touching" score + routine to the bullet sprite, unless you get kills also by running into the other tank.

One of your other comments had to do with moving and turning simultaneously. Scratch makes this easy. If you tell a sprite to move and turn at the same time, it will move in an arc. I don't think you really need a Velocity function. Your background is stationary and your tanks don't jump. You could make a routine so that after the player stops pressing a movement key, movement continues for a moment before stopping.

Block 3- Again, I'm failing to see how Velocity is going to benefit your game. If you just want to do it (I'm like that) I would include it in a different project. Don't waste code effort, space and processor speed on something that you don't really need. My opinion anyway

Last edited by Locomule (2009-10-09 17:37:10)


aka Pain from DragonSpires, Delrith Online, BotBattle, Urban Dead etc etc lol

Offline

 

#9 2009-10-09 19:41:38

steppenwulf
Scratcher
Registered: 2009-07-23
Posts: 1000+

Re: Quite a few questions....

Kokan wrote:

Thanks for your velocity tutorial is has helped a lot!

Adding these functions has again created some problems with my overall game. Can anyone answer questions regarding the projectiles, and changing direction with velocity.

1. I have used the script for the bullet and something does fire out. But it only ever comes from the one direction. I plan on having it shoot from the from of the tank sprite.  No matter how I position my tank. Would I have to attach a sprite onto my tank sprite and aim it somehow in the front direction?

2. The velocity movement has worked. But the directional input is not the same as it was without velocity. Orginally I had the tank being able to turn in directions and move at the same time. But now with the velocity it does not move in the direction it's pointing to. Instead the sprite turns to a diffrent direction but continues to move in the same direction.

Sorry for the long post, and again any help would be great.

Thanks.

I'm glad I could help  big_smile  I will try to remember how to do multidirectional shooting and post later if I do.


I'm graduating HS this April and going to college in the Fall.

Offline

 

Board footer