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

#1 2010-09-21 02:29:28

optyks
New Scratcher
Registered: 2010-09-05
Posts: 12

Little help?

just making a simple game real quick this week. Have a short time period to do it, and it doesn't need to be anything fancy.  Been tinkering around for an hour or two, and I'm starting to get the desired results that I want, but a couple questions..

When i press space to fire a projectile, I want ithe projectile to disappear when it hits my randomly placed target.
It's real iffy right now. Sometimes it disappears when it hits the target, sometimes it continues to the top where i have it coded to stop, in the same instruction...
This is in my projectile...
http://i10.photobucket.com/albums/a115/Falkon114/Picture1-17.png

This is in my target.
http://i10.photobucket.com/albums/a115/Falkon114/Picture2-13.png

Offline

 

#2 2010-09-21 07:49:32

AtomicBawm3
Scratcher
Registered: 2009-06-27
Posts: 1000+

Re: Little help?

I think your problem is how you coded it with "forever if" blocks.  Instead, try and do the same thing with "forever" and "if" blocks.  That might also reduce the amount of scripts if you can combine them.  Also, instead of using the y position > 179, use the "touching <edge>?" block.  If it still doesn't work, post the project and Ill see what I can do.


http://i50.tinypic.com/j0yw0p.jpg

Offline

 

#3 2010-09-21 07:49:42

demosthenes
Retired Community Moderator
Registered: 2008-02-19
Posts: 1000+

Re: Little help?

Your scripts look pretty good and you've got the right idea, but I think you are making it more complicated than it needs to be.

Here are the basic scripts I would use, then, if you want, you can add the other variables you had:
Sprite4 (Bullet):

http://img62.imageshack.us/img62/6821/projectile.gif

Sprite7 (Target):

http://img121.imageshack.us/img121/4662/targetr.gif


If you have any questions or want something closer to your original scripts, just ask  smile



EDIT: I've changed the first script because it didn't have a "Go To" block.
Make sure this "Go To" block is selected for wherever the bullet should start.

Last edited by demosthenes (2010-09-21 07:58:38)


I've taken a long hiatus, but I still visit sometimes. Give me some time to answer any messages you post on my projects!

Offline

 

#4 2010-09-21 11:24:19

optyks
New Scratcher
Registered: 2010-09-05
Posts: 12

Re: Little help?

it could be that it's early in the morning right now, but I can't seem to implement those scripts and get them to function at all. I'll keep workin at it, and thanks for the quick replies! i'll come back if/when i'm still stuck

Offline

 

#5 2010-09-21 15:34:58

optyks
New Scratcher
Registered: 2010-09-05
Posts: 12

Re: Little help?

I want to upload my project on here so you cans can take a look at where i've gone. just started over from scratch.
I more or less got what I wanted, now I just want to make the projectile dissappear when it hits the target. Seems to be pretty glitchy with all the ways I've tried... how can I get the whole project up here?

Offline

 

#6 2010-09-21 20:18:28

demosthenes
Retired Community Moderator
Registered: 2008-02-19
Posts: 1000+

Re: Little help?

When you have open Scratch 1.4, click on the menu that says "Share" (it's next to the "Edit and "Help" menus). Then hit "Share this project online". It should be pretty intuitive from there.

Once you've uploaded please post here and I'll try and help you get your scripts working  smile


I've taken a long hiatus, but I still visit sometimes. Give me some time to answer any messages you post on my projects!

Offline

 

#7 2010-09-22 02:00:33

optyks
New Scratcher
Registered: 2010-09-05
Posts: 12

Re: Little help?

Awesome, thanks!
I got it uploaded... Few things I'm looking to correct overall, but feel free to assist with as much or as little as you feel...
Eventually, I'd like a scrolling background, so it makes the ship look like its moving forward. This is a luxury, though, something I'd use only if I get the whole game to work how I'd like.

the bullet should be "tethered" to the ship sprite... the whole it stays in the middle at the beginning isn't choice.

I dunno if this is just how scratch works, but any time a new projectile is fired, there's a very faint and brief blip of the previous bullet instance's stopping point.

finally, sometimes the target box will spawn in very much the same space as previously... maybe correct this?

Those are just my current goals, but again, I'm not asking you consider all of them. Its just a quick assignment and only have a couple days.
Thanks in advance! you're awesome.

Offline

 

#8 2010-09-22 12:39:19

optyks
New Scratcher
Registered: 2010-09-05
Posts: 12

Re: Little help?

Hmm, alright upon more work, I got the bullet "tethered" issue to work fine. Forget the scrolling background, the current one works fine..
Here are my final goals:
~Fire a projectile each time space is pressed. I thought that the broadcast [shoot] (and not wait) command would work, but it doesnt... Should I just duplicate the sprite and all the code with it?

~Clear the background of the ship. I'm not sure how to do it in photoshop, and can't find any good tutorials on doing so. Right now theres a black box around it... =/

~optionally, make the target box set on a timer so that after x time (2 seconds or so) you lose points like it's a miss and the box moves somewhere else... for some reason, the If timer > 2, [do the random spawn part] doesnt do... anything. suggestions?


Other than that, I'm pretty pleased * my progress thus far.

Offline

 

Board footer