Someone explain the finished ghost shooter event sheet

0 favourites
  • 4 posts
From the Asset Store
181 High quality audio files for your Zombie and Ghosts
  • How does the computer know the monsterspeed variable is the speed of the monsters? why does the description say it increases the speed monsters are spawning at but it actually just increases the monsters movement ?

    In the ""If a monster is within 200 pixels of the player, make it start rotating towards them.", why is the angle set to rotate to1 degree to the player ?

    why does the tutorial make no attempt at explaining this things and expect complete beginners to just understand it ?

  • Try Construct 3

    Develop games in your browser. Powerful, performant & highly capable.

    Try Now Construct 3 users don't see these ads
  • Hello,

    Looking at the events that monsterSpeed variable is used four places.

    1. Where the variable is made as a global variable.

    2. Where it’s increased every time an enemy is killed.

    3. Under the every 3 seconds, it’s used to set the speed of newly created enemy.

    4. And when you hit space to reset the game. It’s set back to an initial small value. Most things get reset automatically when restarting or changing layouts, but when something is global it doesn’t reset automatically. This is useful for keeping scores between layouts or stuff like that. So anyways, in this case they wanted to reset it and not keep its value so it was done manually.

    I agree with you about the comment. It’s increasing the speed of the new enemies, not the rate they spawn.

    There seems to be lots of YouTube channels with video tutorials that may be useful to you. Especially if they explain what they are trying to do and explain each part.

    Anyways, here are my thoughts on how I’d come up with some of the enemy events.

    So first we have some enemies. We want them to move forward so we give them the bullet behavior and see them happily trudging forward.

    If it’s too fast or slow we adjust the speed in the layout editor.

    Ok cool. But these enemies seem pretty dumb. The player can avoid them easily. How about we have them chase the player? One way to do that is to change their angle to face the player.

    Every tick:

    — enemy: set angle towards (player.x, player.y)

    We test that and the enemies turn instantly to the player and pile up on him. The player can only get away if they are faster.

    So what if we made the the turning more gradual? Like maybe turn 1degree per frame toward the player? That would look like:

    Every tick

    — enemy: rotate 1 degree towards (player.x, player.y)

    The result is kind of nice now. Even is the enemies are a bit faster than the player you can out turn them. It gives the enemies a lumbering zombie like quality.

    However all the enemies seem to know where the player is at all times. What if their senses were more realistic. Like they could only detect the player if they were close enough.

    So how would we do that? There isn’t a compare distance condition. But we could use the compare values condition with an expression. There’s an expression called “distance” that will give you the distance between two points. So how close should the enemy and player be between each other for the enemy to year. Let’s say 200 or less so every position in a 200 pixel radius circle

    So we can change our event to

    Every tick

    Compare two values distance(player.x,player.y,enemy.x,enemy.y<200

    — enemy: rotate 1 degree toward (player.x, player.y)

    You can actually remove the every tick condition, since events are run every tick already.

    So anyways we test this and something seems amiss. It will work perfectly with a single enemy but with multiple it will seem to work with only the first enemy and not the rest. The reason has to do with picking. The system compare condition does no picking. It just uses the position of the first enemy instance in that distance calculation.

    Anyways we need to find the distance between each enemy and the player. One solution is use for each enemy to do that. What for each does is look at each instance one at a time.

    So the result is:

    For each enemy

    Compare two values distance(player.x,player.y,enemy.x,enemy.y<200

    — enemy: rotate 1 degree toward (player.x, player.y)

    Which works how we want it.

    Alternatively we could use a different condition like pick by comparison. It only will pick the enemies inside that radius. It will work the same for our purposes.

    System: Pick enemy by comparison: distance(player.x,player.y,enemy.x,enemy.y<200

    — enemy: rotate 1 degree toward (player.x, player.y)

    Anyways, hope some of that helps. I don’t have time to screenshot events so hopefully that text makes sense. I don’t usually write things so detailed but that is my thought process when I make events. The difference is over time you find more features you can utilize.

    -cheers

  • MonsterSpeed = 80 is known as a global variable

    Global Meaning it can be accessed from everywhere

    Variable meaning it can be changed

    "Also increase the speed monsters are spawning at" is a note explaining what the

    System: Add 1 to MonsterSpeed does

    Each time a monster is shot then the variable gains 1. So the first monster will have MonsterSpeed 81 then 82, 83, 84. I imagine somewhere in the game they MonsterSpeed variable is used to set how quickly monsters are spawned but I don't see it in the screenshot and I have never worked with this code.

    Hopefully this helps ^^

  • R0J0hound Thank you

Jump to:
Active Users
There are 1 visitors browsing this topic (0 users and 1 guests)