Creating walls and keeping enemies on screen
butterbean
Member Posts: 4,315
I followed the tutorial on how to create a wall, and the objective was to keep the birds flying from the top of the screen down, from appearing on each side of the wall
I also tried tweaking with the numbers and did a change rule when the birds' position is at self position X= "number" to destroy them when they are on each side of the wall
Is there an easier way to do this?
I've tweaked with the numbers, and they still flicker and appear on the sides for a second, and then disappear
I made the width of the walls 8, and the height the height of the screen = 320.
Should I make the walls taller than 320?
Any help would be great, or any ideas in addition to what I've done
I also tried tweaking with the numbers and did a change rule when the birds' position is at self position X= "number" to destroy them when they are on each side of the wall
Is there an easier way to do this?
I've tweaked with the numbers, and they still flicker and appear on the sides for a second, and then disappear
I made the width of the walls 8, and the height the height of the screen = 320.
Should I make the walls taller than 320?
Any help would be great, or any ideas in addition to what I've done
Comments
Dr. Sam Beckett never returned home...
Twitter: https://twitter.com/Quantum_Sheep
Web: https://quantumsheep.itch.io
/adds side scroller to list of games I need to make...
Dr. Sam Beckett never returned home...
Twitter: https://twitter.com/Quantum_Sheep
Web: https://quantumsheep.itch.io
I'm thinking of just spawning the characters randomly from the top of the screen at certain points on the X axis, so instead of putting coordinates (0,480 random), I could replace those coordinates with (3, 477 random) right?
That way they won't be spawning near the walls and will just be spawning on the screen in full visibility
Would this work?
I understand you're not working on a sidescroller, but I've found that a lot of methods work across different games.
Replacing the coordinates with random numbers as you suggested (3, 477) as opposed to (0,480) should certainly work I reckon with regard to spawning the birds.
The issue then becomes, 'How do I stop the birds going through a wall and re-appearing on the other side?' which I think is the problem you describe in your original post. "the objective was to keep the birds flying from the top of the screen down, from appearing on each side of the wall.
Have a go of my game Sol if you like. If you watch the enemies in that, they fly in a general direction OFF the screen, but don't re-appear on the other side of the screen. I don't use any walls on this.
Instead, I use a rule that says:
an attribute changes: self.position.X is less than 0
an attribute changes: self.position.X is greater than 480
an attribute changes: self.position.Y is less than 0
an attribute changes: self.position.Y is greater than 320
Then destroy the actor
This makes it so that if an enemy goes off the screen, they're destroyed, which is what you asked originally *I think*.
Apologies if I've misunderstood your dilemma, but in case I haven't, I hope that helps!
Cheers.
QS
Dr. Sam Beckett never returned home...
Twitter: https://twitter.com/Quantum_Sheep
Web: https://quantumsheep.itch.io
I have the "Spawn bird actor" separate from the birds at the top of the screen, and they are falling down from the top of the screen to the bottom, almost like it's "raining birds"
Should I just do "random spawn (5,410) or something to that effect? So that on the X axis, they aren't appearing on each sides of the wall?
I've actually tried that, and it seems they still appear on the sides.... very strange
I think I'll just need to tweak the coordinates until it looks perfect
I had another question:
I have my actor on the bottom of the screen moving left and right only, how do I contain him so he doesn't float down or up?
Do I use constrain attribute ?