Discuss Scratch

Isurcraft
New Scratcher
10 posts

Enemies on a scrolling game

I've made a scrolling game and have added enemies. I want when a player comes between a certain distance the enemy starts shooting and when the player goes he stops.

Last edited by Isurcraft (March 23, 2017 23:24:21)

CutieCow17
Scratcher
1000+ posts

Enemies on a scrolling game

This forum is for general questions. This belongs in ‘help with scripts’. I'll report it to be moved.

Also, you might want to provide a link.
HoofEMP
Scratcher
100+ posts

Enemies on a scrolling game

In the enemy's shooting script, use this if:

ifabsofxposition-playerxvalue<intendedrangethenshoot

If player x can fluctuate, just incorporate this script into the player's sprite:

whenclickedforeversetplayer x valuetoxposition

Last edited by HoofEMP (March 24, 2017 04:43:20)

Isurcraft
New Scratcher
10 posts

Enemies on a scrolling game

https://scratch.mit.edu/projects/148723986/

Here is my game. HoofEMP unless I did it wrong it didn't work
HoofEMP
Scratcher
100+ posts

Enemies on a scrolling game

Isurcraft wrote:

https://scratch.mit.edu/projects/148723986/

Here is my game. HoofEMP unless I did it wrong it didn't work
Okay. You're not going to need the player x value variable. Your character's always at x = -17. Anyway, the main problem seems to be that you don't have a shooting script to begin with. In fact, I can't find any concept of health or death in sarah, and you're completely missing a game over broadcast! Try adding the those as well as a script for shooting (the best way to go about doing this is with clones). Speaking of clones, you should try using them instead of having multiple seemingly identical enemies and coins. Doing so will prevent clutter and lag later in development, and cutting down on the forevers will also generously reward you with performance. I couldn't even get the game running smoothly on my laptop.

Sorry about the tangent there. But you need to, at the very least, implement a shooting script for Hero Boy. This subforum is for troubleshooting your scripts, not making them for you.
Isurcraft
New Scratcher
10 posts

Enemies on a scrolling game

thanks for the help I'm only new to scratch and this is my first question ill try my best

Powered by DjangoBB