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
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.
Offline
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):
Sprite7 (Target):
If you have any questions or want something closer to your original scripts, just ask
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)
Offline
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
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
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
Offline
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
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