Discuss Scratch
- Discussion Forums
- » Help with Scripts
- » Player Vision Formula Not Working Correctly
- _Euphoric_
- Scratcher
10 posts
Player Vision Formula Not Working Correctly
The Project
SO basically I made this infinite fighting game, with randomly spawning enemies. But the problem is that the enemies are supposed to stay on the ground (I used a basic scrolling mechanism) and not with the player while the player is in the air (jumping). And also, when the player moves, the enemy is supposed to appear moving in the other direction. This also does not work. And finally, I added a formula that, if the enemy is in the player's FoV (240 pixels of x) the enemy appears (ghost set to 0), otherwise it hides (ghost set to 100). The formula is something like this:
*serious suggestions and comments only, please do not advertise your problem or say “maybe this…” *
SO basically I made this infinite fighting game, with randomly spawning enemies. But the problem is that the enemies are supposed to stay on the ground (I used a basic scrolling mechanism) and not with the player while the player is in the air (jumping). And also, when the player moves, the enemy is supposed to appear moving in the other direction. This also does not work. And finally, I added a formula that, if the enemy is in the player's FoV (240 pixels of x) the enemy appears (ghost set to 0), otherwise it hides (ghost set to 100). The formula is something like this:
if <<((player x) - [240]) > (myXpos)> or <((player x) + [240]) > (myXpos)>> then
set enemy to cannot see me :: custom
else
set enemy to can see me :: custom
end
*serious suggestions and comments only, please do not advertise your problem or say “maybe this…” *
Last edited by _Euphoric_ (March 9, 2022 22:54:05)
I have moved from @ImAnPopularYoutuber1 to here, so I have like 5 posts instead of 100+.
when green flag clicked
cringe :: custom
- Discussion Forums
- » Help with Scripts
- » Player Vision Formula Not Working Correctly