Creating walls and keeping enemies on screen

butterbeanbutterbean Member Posts: 4,315
edited November -1 in Working with GS (Mac)
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

:)

Comments

  • quantumsheepquantumsheep Member Posts: 8,188
    Do give the birds a 'bounce' attribute?

    Dr. Sam Beckett never returned home...
    Twitter: https://twitter.com/Quantum_Sheep
    Web: https://quantumsheep.itch.io

  • butterbeanbutterbean Member Posts: 4,315
    Yes I've added the "bounce" attribute as well to both the birds and the actor
  • quantumsheepquantumsheep Member Posts: 8,188
    Take a loot at the side scrolling template. I've notice in that game that it stops you moving off the top or bottom of the screen. Maybe it would help to take a look at how the did that?

    /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

  • butterbeanbutterbean Member Posts: 4,315
    This isn't a sidescrolling shooter, it's a shmup on just the one screen, I've created walls for the characters to bounce off of, but you can still see a "flicker" of a character in the corner at times, and it's just momentarily

    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?
  • nulonulo Member Posts: 315
    i guess it could work.(the 3, 477 random) but i still didnt quite understand what your going for, so cant help you with much.
  • quantumsheepquantumsheep Member Posts: 8,188
    Hey there butterbean!

    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

  • butterbeanbutterbean Member Posts: 4,315
    I tried what you said before, and tried it again, and when I place all those attributes within the bird, they won't spawn

    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
  • butterbeanbutterbean Member Posts: 4,315
    And another thing, when I put in attribute, when self position x is greater than 480, destroy actor, the birds won't spawn on part of the left side of the screen, but only come down on the right.

    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 ?
Sign In or Register to comment.