Git Product home page Git Product logo

retrorampage's Issues

Operator argument #2 must precede operator argument #1

Hi and thanks for this awesome tutorial! It's a great project and I really like how you're presenting it.
I've run into a problem a bunch of times though that i really dont get. I'm somewhere in the beginning of part 3 now and i'm told to enter
player.direction = input.velocity / length in world.update.
byt that gives me the error
Operator argument #2 must precede operator argument #1
I've gotten this a few times before and then i've been able to flip it around since it's been multiplication. This time however it's division so i can't flip it.
I've googled the error without finding anything but I'm pretty new to coding so maybe it's just me...

Different player speed for unknown reason

Weird thing happened:

I finished part 2 of this (awesome!) tutorial & had a weird feeling about how fast my "character" (blue box) was moving.
So I downloaded the source code for part 2 & just ran it on my iPhone.
And for some weird reason, the "character" in the game built from github source moves almost half the speed...

I checked the code and ignoring some added whitespace, my code & github source are identical. Same constants, same functions, same everything - I followed the tutorial step by step & copy/pasted everything as instructed.

Here are the screen recordings comparing my "version" & the source:
Archive.zip

P.S.: I'm not sure this is really an issue in the github sense - sorry if it isn't ๐Ÿ˜€

P.P.S.: I'll compare all the files again first thing in the morning - there is a chance I missed something, but I'm pretty sure I didn't (I wouldn't be opening an issue otherwise)

Part 1 - Ready Player One - where to put Player.swift

Hello Nick,

in Part 1 - Ready Player One - you say you should create a new Player.swift file.

You didn't specify the location. I put it inside Engine after looking at the provided source code.

Just a tiny thing I stumbled upon ๐Ÿ™‚. I am really enjoying your tutorial so far - thank you very much!

BR Denise

Small Issue in Part 6

I'm absolutely loving this series! Thanks so much. ๐Ÿ™๐Ÿป
I stumbled through this part of the update [line 495], and just wanted to let you know.

Now, in the Monster.update() method, modify the state machine again to swap the animations:

switch monster.state {
case .idle:
    if monster.canSeePlayer(in: self) {
        state = .chasing
        animation = .monsterWalk
    }
case .chasing:
    guard monster.canSeePlayer(in: self) else {
        state = .idle
        animation = .monsterIdle
        break
    }
    ...
}

I changed it so it would compile (leaving the velocity intact for now) :

    mutating func update(in world: World) {
        switch state {
        /// all the monster needs to do is wait until it sees the player.
        /// That means we need a method to detect if the monster can see the player
        /// since they always face the player, just check if there is a wall between them
        case .idle:
            if canSeePlayer(in: world) {
                state = .chasing
                animation = .monsterWalk
            }
            velocity = Vector(x: 0, y: 0)
        case .chasing:
            guard canSeePlayer(in: world) else {
                state = .idle
                animation = .monsterIdle
                break
            }
            let direction = world.player.position - position
            velocity = direction * (speed / direction.length)
        }
    }

Part 5 - Footnote 1 inaccurate

Thanks for the tutorial, really enjoying it.

One correction/note on part 5. According to footnote 1:

Long before modern GPU technology, consoles such as the SNES included built-in support for scaling and rotating sprites instead of just moving them around.

The SNES Mode 7 could only scale/rotate backgrounds - specifically not sprites. See the linked https://en.wikipedia.org/wiki/Mode_7#Limits:

Mode 7 can only work on backgrounds, not sprites; therefore, any object that does not rotate or scale with the background must be a sprite, even items that would normally be thought of as part of the background, such as fixed platforms.

While mode 7 is still relevant/interesting, sprites were used in the same way you describe them for enemies and items in Wolf3D. For example, Super Mario Kart uses Mode 7 to scale/rotate the course as a background, but the characters in their karts are sprites pre-drawn at different sizes/angles. Later games that included specialized DSP chips were able to sprite scaling/rotation, but that's not Mode 7 and not built in to the console :).

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.