Discuss Scratch

2ofwands
New Scratcher
4 posts

Need help with first project platformer - projectile scripts and more

Hi everyone, first post in this forum and very new to Scratch. I have minor experience in web design with html/css and have recently enrolled in Harvard's CS50.

Just trying to complete my first project but I may have decided on a project that is a little too ambitious for where I am at with my Scratch understanding.

My project is a very simple 2D platform shooter. Summary of game:

- 3 levels total, NOT side scrolling, fixed screen
- PLAYER sprite must dodge enemy projectiles and sprites
- I would like to increase a score or meter every time PLAYER has successfully jumped over an enemy projectile/sprite
- Once PLAYER score or meter has reached full, PLAYER is able to shoot projectile only once - PLAYER must recharge meter before shooting again
- If PLAYER is able to hit enemy sprite with 3 projectiles, level advances to next until level 3 is finished

I just hit a wall in programming and can't find any documentation that might help me with the following questions:

- How can I write a script for my PLAYER sprite so that when it jumps over a projectile the score/meter is increased by 1?
- How would I make it so that the PLAYER can only shoot the projectile if the score/meter is full?


I have no doubt that I will have more questions later, but if I can't move past this particular script then I'm probably going to change the game plan to something much more basic!

Any help would be greatly appreciated.

Cheers,

2ofWands
Feigh10
Scratcher
19 posts

Need help with first project platformer - projectile scripts and more

if <<player is shooting> and <meter is full>> then
shoot
end


sorry if this was no help…

Last edited by Feigh10 (Nov. 3, 2020 23:06:13)


forever
if <sasuages are nice> then
say [Sausages are nice]
end
end



























Hi
2ofwands
New Scratcher
4 posts

Need help with first project platformer - projectile scripts and more

Thanks anyways haha!

I really want to be able to charge up the meter by jumping over the projectiles. I have the shoot function down, but you're able to shoot multiple times…

when [<key [ space v] pressed?> v] key pressed
broadcast [shoot v] and wait
wait until <not <key [space v] pressed?>>

Then in the projectile sprite, there's some code so it goes across the screen or until it hits an enemy sprite.

Hardest part is triggering the meter when the PLAYER sprite jumps over a projectile.

I might just convert this project to a space shooter .
2ofwands
New Scratcher
4 posts

Need help with first project platformer - projectile scripts and more

Here's a link to my project so far - place holders are in place…

WORK IN PROGRESS PROJECT

Last edited by 2ofwands (Nov. 3, 2020 23:23:35)

2ofwands
New Scratcher
4 posts

Need help with first project platformer - projectile scripts and more

I DID IT!!!!!!!

I was able to create a vertical line above the projectile so that when my PLAYER touches the vertical line by jumping over the projectile, the meter is increased by 1!!!!!!!!! I also made the sensor invisible.

Powered by DjangoBB