#Moving a player(going insane)

1 messages · Page 1 of 1 (latest)

umbral saffron
#

so basically im at the point where i think the move code itself may be in play or perhaps that the movement may still be set to input and i just dont know how to turn it off

rotund crag
#

Can you give me a short rundown on what you mean or have so far? I am not up to date
What behaviour is happening?
What do you want to happen?
Then we can look at code

umbral saffron
#

so what i want to happen is have a toggle where when you press I, you 'go insane' causing the player to walk and turn in random directions.

#

the player is not moving a t a l l

rotund crag
#

Gotcha

#

Ok so Lets just do some simple debugging, you may already have some in place.
Do you know if the toggle is working?

#

meaning When you click i the bool is changing

#

Thats the first step

umbral saffron
#

yes. i have a toggle in the insane and sane functions in the insane code that says "insane" or "sane"

rotund crag
#

Ok so comment out everything except the debug.log in Insanity, just for simplicity sake. We are ONLY testing to see if the method is being called correctly at first, then we can worry about the movement

umbral saffron
#

gotcha

#

and then run and see if it calls?

rotund crag
#

Yupp. And we will know if its working if we see in the console, the correct thing

#

If we dont see Anything in the console, it isnt even being called

#

Which would be the first thing to fix

umbral saffron
#

sorry the test thing is to test if something else is working

rotund crag
#

So The Insane is being called.

#

Is the Insanity ? I dont see it

umbral saffron
#

yeah see,"insane"

rotund crag
#

Sorry i meant sanity

umbral saffron
#

oh

rotund crag
#

Therse a button called 'collapse' at the top of the console tab

#

click that and itll make it easier to read console

umbral saffron
#

all of this after I press 'I'

rotund crag
#

Ok so show me the code where you are calling these functions from

#

Seems to be working so far

umbral saffron
#

sorry if its a mess, i havent cleaned up and tbh i got the movement code from a tut

rotund crag
#

its ok

#

Can you show me entire 2 scripts with numbered lines and everything

umbral saffron
#

how do i do numbered lines

#

nvm

rotund crag
#

Just when you take your screenshot be sure to include the line numbers more to the left

umbral saffron
#

just the first one 🤣

#

the like 10000000 or something was to test if maybe it was just moving realllllllllllllllly slow

rotund crag
#

Ok so heres the thing, yes your code is sloppy, but I wouldn't mind helping you out but we gotta clean some stuff up and in the process, you'll learn some things as to the thought process. Would that be something your ok with?

umbral saffron
#

im all for it

rotund crag
#

Cool. One thing at a time.

#

You see how you have your Insane class right?

umbral saffron
#

that would be the script

#

correct?

rotund crag
#

Correct.

umbral saffron
#

yup

rotund crag
#

Interchangable by the way when people say script or class

umbral saffron
#

i inferred that

rotund crag
#

A class is a blueprint to how something is, or should work.

umbral saffron
#

yeah

rotund crag
#

So your Insane class is a blueprint to........whether a player is insane or not.

umbral saffron
#

basically its the innerworkings of like the insane thing

#

so in short, yeah

rotund crag
#

Cool. By the way I'm going to ask you questions, these questions are going to hopefully get you to see some stuff

umbral saffron
#

go ahead

rotund crag
#

So knowing thats what the insane class is about, whats your PlayerMovement class about?

umbral saffron
#

its about, moving, jumping, and sprinting using the character controller

rotund crag
#

What are all those things, whats the common theme about them?

umbral saffron
#

and it also asks for the input that makes you go insane

#

they are all movement based

rotund crag
#

Make it really simple, yupp

#

Its all related to the Movement of the Player

umbral saffron
#

yup

rotund crag
#

So first big thing I see wrong is, what is your Insanity() method doing?

umbral saffron
#

what i tried to do is make it make you start walking, without needing input

#

and it also stores a reference to the script, so that i can access the methods and variables from the movement script

rotund crag
#

So in essence, your Insanity() method is
Getting a reference
Making the player move

umbral saffron
#

yeah

rotund crag
#

In programming there is something called the SRP - Single responsibility rule. Its basically that a class should handle the things its about and not much else. What can you infer is wrong with Insane class handling movement?

umbral saffron
#

that referencing it may make it harder than it needs to be

rotund crag
#

Thats one thing yupp. The main thing is that now you are handling movement in two places. And you are handling movement outside of the PlayerMovement class

umbral saffron
#

OOOOOOOH

rotund crag
#

So when looking for movement related bugs, how many places can things go wrong

umbral saffron
#

like mannnny

rotund crag
#

yupp

umbral saffron
#

but to be simple 2+

rotund crag
#

So the idea is that Insane should only handle logic relating to .....being sane or insane. PlayerMovement should handle most of the .....movement

umbral saffron
#

gotcha

#

imma make some changes, brb

rotund crag
#

Cool, ask if you need help

#

Ima go get something out the oven will brb

umbral saffron
#

to startttttt

#

i moved all of the movement stuff out of the Insane class and took the stuff about insanity out of the movement class and put that into the Insane class

rotund crag
#

Ok so first lets clean up Insane class

#

Gj btw

umbral saffron
#

thanks

rotund crag
#

First thing, do you think we need a reference to movement in the Insane class anymore?

umbral saffron
#

true i dont

rotund crag
#

Bingo

#

So remove that, and get rid of all the unecessary spaces in those functions

umbral saffron
rotund crag
#

nice and cleannnnn

#

Now we are moving

umbral saffron
#

yeahhhhhhhhhhhhhhhh

rotund crag
#

Ok so lets go to next step in Insane class

#

What is happening in the
If (input.blah blah balah Keycode.I)
{
}

#

Explain it to me

#

This whole thing we are about to do is going to maybe take a little bit longer but once you get it, its going to be awesome

umbral saffron
#

so basically the first one says "hey have we pressed I? we have? insane. no? not insane

#

nope sratch

rotund crag
#

I only care about the I part

umbral saffron
#

wrong order

rotund crag
#

forget the others right now\

#

Just the whats in the first if statement

umbral saffron
#

crazy = !crazy. i was told that would work as a toggle

rotund crag
#

Yupp. Do you understand why that is?

umbral saffron
#

because it sets crazy to the opposite of itself

#

so a toggle

rotund crag
#

Yupp, what are the possible values of crazy?

umbral saffron
#

true,false, and maybbbbbbbbbbeeeeeee null?

rotund crag
#

True and false

#

only

umbral saffron
#

i thought so i jsut wanted to check

rotund crag
#

Ok so it can only be true or false.
So this is whats actually happening

Lets say crazy is false at the start.

if (Input.GetKeyDown(Keycode.I))
{ //false   true
  crazy  = !crazy;
}

Now that crazy is true, lets see what happens when you click i again

if (Input.GetKeyDown(Keycode.I))
{ //true    false
  crazy  = !crazy;
}

I've written the actualy value above the statement so you can see

umbral saffron
#

ok, sorry but that looks normal

rotund crag
#

What do you mean by that?

umbral saffron
#

it seems to switch

rotund crag
#

Im just making sure you are aware of the actual value crazy is holding at any certain point.

umbral saffron
#

gotcha

rotund crag
#

Yea its working. I just want to make sure you know what that means

umbral saffron
#

i thought you were showing me that something was wrong

rotund crag
#

Im about to lol

#

:p

umbral saffron
#

oh

rotund crag
#

So you have those 2 functions right?

umbral saffron
#

yup, insane and sane

rotund crag
#

Actually ill start with something else.

Right below the first if statement in Update, you have 2 other if statements

umbral saffron
#

no

#

one

#

sorry if i sound rude

rotund crag
#

Not at all

#

You dont sound rude lol

#

Dont worry about that

#

sounding rude that is, there is no emotion shown in typing most of the time

umbral saffron
#

yeah

rotund crag
#

Ok so heres my questions to you

#

Are the 2 functions in Insane class going to SET whether a player is insane or are they just there to what should happen WHEN a player is sane or insane

umbral saffron
#

crazy is the bool which says if insane or not, the two functions just dictate the workings of the insanity or sanity

rotund crag
#

Whats inside of Insanity() or Sanity(), is it all movement related? Or is there more to it?

#

Im asking in the future

umbral saffron
#

sorry im back

#

i had to make dinner

rotund crag
#

all good

rotund crag
#

Thats what inside them right now. What you need to ask yourself is "What is everything I want to happen if Sane or Insane right.

umbral saffron
#

oh gotcha

rotund crag
#

For example -

#

Lets say the only thing that happens when something goes insane, is movement related.

#

Then it would actually make perfect sense to put that logic of Insanity inside of PlayerMovement, because its only movement related, and PlayerMovement handles all of the movement

umbral saffron
#

the thing that i want to happen, as this is for a prototype is that it makes the player run randomly and make turns randomly. I also want it to perhaps put some effects on, sound effects, what not

rotund crag
#

Ok well, for the purpose of this little learning thing goin on, lets say assume its movement only right now. You can always refactor (reorganize, rename, etc) it later if you want to add more stuff and then it makes less sense for the playermovement class to handle it all.

umbral saffron
#

yup

rotund crag
#

So I dont want to go crazy here cuz I want you to learn alot personally but then again, I'm going to just nudge you in the right direction

umbral saffron
#

ok

rotund crag
#

The if else below your if (i is pressed) statement seem redundant to me

umbral saffron
#

oh yeahhhhh

rotund crag
#

They are saying to check every frame
If (i am crazy)
{
Do crazy stuff
}
else
{
Do sane stuff
}

#

Which is essentially what your toggle could be doing if the logic is placed inside of PlayerMovement.

umbral saffron
#

yeah

rotund crag
#

So imagine this Insane class handles....being insane or not

umbral saffron
#

yup

rotund crag
#

And then just passes that info along (when you press I)

#

to PlayerMovement

umbral saffron
#

so put the insane methods into playermovement?

rotund crag
#

So where would you place the actual logic to being insane or sanity

#

Yupp.

#

This is why naming is kinda a big deal

#

I know you said you are 'fine' with your naming but the sooner you grow at this part of programming is makes everything so much easier

#

So for bools

umbral saffron
#

gotcha

rotund crag
#

which can only be true or false

#

usually the names start with
is or has

isCrazy
hasApples
hasGold
isAlive

umbral saffron
#

gotcha

rotund crag
#

so that when you call them from another class using the .

#

it makes sense

#

Imagine this

umbral saffron
#

ahhhhhhhhh

#

yessss

rotund crag
#

if (PlayerMentalState.isCrazy == true)

#

It reads more like english

umbral saffron
#

yup

rotund crag
#

than
if (Insane.crazy == true)

#

So just a thought

#

you dont have to rename everything right now

umbral saffron
#

i already renamed crazy to IsCrazy

rotund crag
#

make sure the first letter is always lowercase

#

All capitals is for Class names

umbral saffron
#

oh

rotund crag
#

This helps yourself and others know what things are just by glancing at it

#

Or what kind of things they are, such as is this a boolean, or is it a class?

umbral saffron
#

yeah

rotund crag
#

isMoving is easy to see instantly, hey thats a boolean

umbral saffron
#

yup

rotund crag
#

Movement easy to see this is a class

#

Cool

umbral saffron
#

yup

rotund crag
#

Ok so How bout you get rid of everything you dont need in Insane class

#

really only need the toggle right now

umbral saffron
rotund crag
#

Yupp

#

So now we can move to playermovement class

umbral saffron
#

woooh thats gonna be alot to unpack

rotund crag
#

It wont be near as hard now tho

umbral saffron
#

oh

rotund crag
#

because this other class is so simple now

umbral saffron
#

brb gtta grab something

rotund crag
#

k

umbral saffron
#

back

rotund crag
#

so i can read it and not use screenshots

#

all you have to do is copy and paste your code into the text spot and make sure the pull down menu below is on c#

#

and then hit paste it

#

it will give you a link you can share with me

umbral saffron
rotund crag
#

Ok so first off, do you think we need the public bool Insane; in this class?

umbral saffron
#

i had it because i wanted to reference it but now i dont, so no

rotund crag
#

Well so you werent really referencing there. You were creating another one that has nothing to do with the one in Insane class

#

another bool, completely separate from the other Insane class

umbral saffron
#

gotcha

#

so delete?

rotund crag
#

yupp dont need it

umbral saffron
#

done

rotund crag
#

Cool now we have this toggle going on in the game already that states a bool (crazy) is going to be on or off

#

where in the PlayerMovement code, do you think you need to toggle it on and off?

#

Basically where do you want it to happen at?

umbral saffron
#

nowhere?

rotund crag
#

Oh ok let me ask a question i guess

#

So you want this stuff to happen when you click i right

umbral saffron
#

exactly

rotund crag
#

Ok, so in Update you can add the logic of if insane do this stuff with the movement and if not do regular stuff

umbral saffron
#

yeah

rotund crag
#

First though

#

I want to explain a concept

#

that will make this easier

umbral saffron
#

go ahead

rotund crag
#

You've got ALLLL this code doing stuff in update, and its not all doing one thing

#

can you explain to me the different parts of the update. What I mean by that is, for example, part of this code in update is handling whether you should jump or not right?

#

Give me a short list of some things that are being done in Update. Not every single little thing, but just the big ideas

#

Like Jumping

umbral saffron
#

ok, it sets the variables that will help move the player, it also handles said movement, jumping, and sprinting

#

ngl im winging it here cause i am confused at the code from the tut

rotund crag
#

its ok

#

theres no pressure here you answered with 'movement, jumping, and sprinting'

umbral saffron
#

yup

rotund crag
#

Those are some 'high level' things its doing, thats what I was looking for

umbral saffron
#

gotcha

rotund crag
#

So what I want you to do is realize that you are reading a ton of....kinda hard to read code cuz you have to look at all of it in update at any one time

umbral saffron
#

makes sense

rotund crag
#

If you want to read code about jumping, well its in the middle of all this other code right?

#

It can get overwhelming

umbral saffron
#

yessssss

rotund crag
#

So what IDE are you in?

umbral saffron
#

too much stimuli

rotund crag
#

Visual studio code?

#

or visual studio community

umbral saffron
#

yes

rotund crag
#

Code?

umbral saffron
rotund crag
#

Ah ok

#

So ill show you the manual way first

#

Lets start with the jumping part of the code

#

You know you can hit control + z to undo anything right?

#

Dont do it just letting you know

#

That if you make something dissapear, its ok you can get it back as we go through this

umbral saffron
#

yup

rotund crag
#

Ok cool

#

So First thing would be make a new function to put the Jumping part of the code in Update in

umbral saffron
#

okay

rotund crag
#

this can be a private function too

umbral saffron
#

gotcha

#

lemme give that a shot

rotund crag
#

We dont need other classes using it

#

k

umbral saffron
rotund crag
#

Beautiful

#

Now what would be the next step

#

still pertaining to Jump()

#

you may have already done this

umbral saffron
#

trying to either access it or toggle it on or off

rotund crag
#

No

#

uhm

#

So you put the jump code in a function right?

umbral saffron
#

yup

rotund crag
#

It looks like you created the function inside of update

#

is that correct?

umbral saffron
#

yes

rotund crag
#

So the problem of reading is the same

umbral saffron
#

ohhhhhhhhhhhhhhhhhhhhhh

rotund crag
#

Create the function outside of update

#

and then call it inside of update

umbral saffron
#

would i move this down to outside of update so i can stop the error which says that movementdirectiony doesnt exist in its current context

rotund crag
#

Don't focus on those problem just yet

umbral saffron
#

ok

rotund crag
#

Also ill offer this, I can hop in a call and explain this better than typing, but totally cool if you dont want to do that

#

I know this can be slow

umbral saffron
#

lemme get a mic brb

rotund crag
#

k

#

Ok so call Jump() back from where it was

#

you put it at top of Update but it wasnt there

umbral saffron
#

tbh i think thats the only time its called 🤣

rotund crag
#

No what i mean is

#

The place where the jump code was before you put it inside the function, you need to call the function at the same place

#

replace it essentiall

#

Like if the jump code was on line 28 - 32
call Jump() on line 28

#

You just placed it on the top of the Update()

#

it wasn't at that spot originally

umbral saffron
rotund crag
#

there we go

#

Ok

umbral saffron
#

yay

rotund crag
#

grab the Sprint section of the code and place it in a function

umbral saffron
#

ok

rotund crag
#

preferable called.....?

umbral saffron
#

Sprint

rotund crag
#

Yupp. Function names do very well as verbs

umbral saffron
#

yuppp

rotund crag
#

Sprint()
Jump()
etc

#

ok

#

lets see code now

umbral saffron
#

what do i do about these? they could make the player sprint OR walk

rotund crag
#

True. So back to the SRP right. A class should be about one thing preferably. A function should do one thing preferably. Its ok to do one or more related things though in this case

umbral saffron
#

ok

rotund crag
#

For now Sprint() should suffice

umbral saffron
rotund crag
#

Yupp we will clean those up in a sec

umbral saffron
#

gotcha

rotund crag
#

Clean up the majority of Update then fix all that stuff

#

So what does update look like now?

umbral saffron
rotund crag
#

What else can you abstract out of Update. I see a big chunk at the bottom

#

and the comment kinda gives a good clue as to a good function name

umbral saffron
#

PlayerRotation?

#

so the canmove stuff

rotund crag
#

and camera yupp

#

RotatePlayerAndCamera

#

()

#

Would be a decent name right now

umbral saffron
#

ohg

rotund crag
#

ohg?

umbral saffron
#

oh*

rotund crag
#

oh cool and remove those spaces 3 unneeded ones

#

or lines*

umbral saffron
#

yup

rotund crag
#

What else can be abstracted to a function in Update?

umbral saffron
#

called recalculateaxes

rotund crag
#

Thats good.

#

have you made functions that return stuff yet?

umbral saffron
#

whats return?

#

sorry

rotund crag
#

so....You have functions and they do stuff

#

right

#

sometimes you need a function that does stuff, and then returns an answer/result/calculation

#

Like its not just doing something, you actually need the result of what has been done

umbral saffron
#

oh i think i know what you mean

rotund crag
#

does that make sense

umbral saffron
#

like the stuff in the ()'s at the end of void blahblahblah

rotund crag
#

No those are parameters and we will get to those ina little bit

#

So make the funciton

#

and we will go from there

umbral saffron
#

already did

rotund crag
#

ok show it to me

umbral saffron
#

the recalculateaxes

rotund crag
#

Yupp

umbral saffron
rotund crag
#

ok so what does this function do?

#

in plain english

#

high level

umbral saffron
#

it sets the vector3s to there respective directions

rotund crag
#

yea but higher level

#

Clue: its the name

umbral saffron
#

oh recalculates the axes for the vector3's

rotund crag
#

Yupp it does a calculation

#

and why do we do calculations?

#

1 + 1 = ?

#

What are we trying to get?

umbral saffron
#

2

#

oh wait

#

lmao

rotund crag
#

yupp 2 is the result. Its what we want right

umbral saffron
#

yup

rotund crag
#

So

#

void means that the function isnt giving us anything back when we call it

umbral saffron
#

ok

rotund crag
#

You can change the Type of the function by replacing void

#

so what is this function going to return to us

umbral saffron
#

the axes

rotund crag
#

And what Type are axes.

umbral saffron
#

vector3s

rotund crag
#

yupp

#

So replace void with Vector3

umbral saffron
#

ok

rotund crag
#

one sec gotta phone call

umbral saffron
#

k

rotund crag
#

Ok back srry

#

Also I think I was a tiny bit mistaken, it can be void srry, Its a good thing to know that functions can return results but I dont think we need that on this

#

So change back to void

#

my bad

#

and replace function where the code was in Update

umbral saffron
#

ok

rotund crag
#

ok so lets look at Update now

#

New pic pls

umbral saffron
rotund crag
#

Now, do you think you still need the comments above some of these?

#

Or does the name itself explain the same thing the comments were doing

umbral saffron
#

true probs not

rotund crag
#

ok well I think thats good enough for now , Now remove unneeded lines and clean up the comments and new pic pls

#

Cool

#

Ok so idk if you are asking yourself why we are doing all this

#

but now when you come into this class

#

can you see how reading whats going on is any easier now?

umbral saffron
#

definitely, way more readable

rotund crag
#

Cool. Not only that but imagine, your jump isnt working

#

Now, because you've named the Class well, PlayerMovement, you go into it because junmping is....a form of movement. And now you have a function called Jump(), where it would be a damn good first place to look at that code to see potentially where the bug arises

umbral saffron
#

exactly

rotund crag
#

Not only does it make it easier to read but also debugging can be easier

#

so

umbral saffron
#

yup

rotund crag
#

lets fix some of the problems

#

You what scope is?

umbral saffron
#

alrightttt

#

uhm, rephrase pls

#

do you mean do you know what scope is?

rotund crag
#

Yes

#

Do you know what scope is?

umbral saffron
#

scope is like the bigness of something, the height of how hard it may be

#

or grand

rotund crag
#

Pertaining to programming

#

specifically

umbral saffron
#

like how big the ambition for the game is. an example of big scope would be: I wanna make a game that simulates real life and has real life graphics now this a stupidly big example but you get the point

rotund crag
#

So thats is for games. I will explain scope to you for programming. Not similar at all

umbral saffron
#

oh

rotund crag
#
Class Player : Monobehaviour {

Vector3 forward;

void Shoot() {
//shoot code
}

void Jump() {
//jump code
}

void Move() {
Vector3 forward = transform.transformDirection(blah blah);
//move code
}

}
#

You've got a class and some functions right

umbral saffron
#

yup

rotund crag
#

I will edit as we go through

#

If you create a variable inside of a function

#

it can be only be used, or accessed in other words, by that function

umbral saffron
#

gotcha

#

ah i see

rotund crag
#

So does Jump() have access to forward?

umbral saffron
#

no

rotund crag
#

Cool

#

Its of local scope to the function Move()

#

But, if we create forward

#

up at the top at a class level scope

umbral saffron
#

ohhhh

rotund crag
#

Now all the functions inside the class can use it and its data.

umbral saffron
#

wait so do i declare them at the top instead of in update

rotund crag
#

Only if you need to.

#

Thats the key

#

And to figure out whether you need to or not

#

You ask yourself, well, how many functions need this?, on other words, does more than one need it right now?

#

And right now, how many do?

umbral saffron
#

are you asking me?

rotund crag
#

yupp

umbral saffron
#

which one

#

the forward?

rotund crag
#

Oh srry, the one we were working on yea

#

You know those errors you were getting

umbral saffron
#

in update

rotund crag
#

Gimme a whole new website script

umbral saffron
#

maybe i should put that code into my new move function

rotund crag
#

So real quick, is that actually the code that moves stuff?

umbral saffron
#

probably

rotund crag
#

Look down a bit in update

#

and youll see characterController.Move

umbral saffron
#

yeah

#

i moved that into move();

rotund crag
#

Oh ok

#

Did you make an ApplyGravity function

umbral saffron
#

and i think i should move this into move too, as it has to do with movemetn

#

nooo

#

i shoulkd

rotund crag
#

Dont move that in just yet

#

Because by clumping these things together you may make something out of order to do with this tutorial you are following

#

So sometimes its not need to make every single thing a function

#

You cleaned up alot its ok if some little statements for now are still in update

umbral saffron
#

ok

rotund crag
#

So what are the errors right now

#

or red squiggly lines

umbral saffron
rotund crag
#

So think to yourself, what variables need to be shared between some functions right now.

#

Start with the moveDirection =

#

line

umbral saffron
#

RecalculateAxes. so i would put it all the way at the top so it shares to everyone

rotund crag
#

Well you would create the variables that need to be shared at the top

#

and then instead of creating them in the functions, you would just assign them

umbral saffron
#

wdym

rotund crag
#

If something has a Type in front of it
Vector3 forward = blah blah blah //this is being created AND defined at the same time
forward = blah blah blah // this is being defined only

#

So you create what you need to create at the top and then define it only in the variables

#

does that make sense

umbral saffron
#

gotcha

#

so define it in the functions

rotund crag
#

Yupp

#

your basically seperating the creation and definition of them into 2 parts so that everything can know about them

umbral saffron
#

what do i do about this because its the opposite

#

because in this case this is what needs variables. and the variables are in a function, but when i put in the code into the function, it freaks out

rotund crag
#

Can you screenshot what part you are talking about

umbral saffron
rotund crag
#

So are you talking about the forward for instance at the top?

#

Also show line numbers and then you can tell me what line you are talking about

umbral saffron
rotund crag
#

Yupp so lets walk through this, look at the ReCalculateAxes()

umbral saffron
#

ok

rotund crag
#

you are both creating and defining all in one

umbral saffron
#

yup

rotund crag
#

Which means only RecalculateAxes knows about em

#

but you can see something else needs to know about them as well

#

so what to do?

umbral saffron
#

create it at the top

rotund crag
#

create it and only create it

umbral saffron
rotund crag
#

I mean you could define it at the top too if you wanted to with something like
Vector3 forward = Vector3.ZERO

#

but you dont have to

umbral saffron
#

thats what it does

rotund crag
#

What what does?

umbral saffron
rotund crag
#

Cool now you've created it at the top

#

next step is to stop creating it anddefining in the function and
only define it

#

you dont need to create it twice

#

you see?

umbral saffron
#

so just this

#

yeah

rotund crag
#

Well you are creating and defining it there

umbral saffron
#

ohhhhhhh

#

wait what do i do about this? sorry if im being dull

rotund crag
#

So you'll get this soon. show me the recalculateAxes function one more time

umbral saffron
rotund crag
#

Ok cool

#

Did that fix the forward part

#

and right

#

the error on those 2

umbral saffron
#

lemme see

#

yup and we have these two on line 49

rotund crag
#

yupp same concept

umbral saffron
#

ok

rotund crag
#

have a go

umbral saffron
#

fixed it

rotund crag
#

nice

#

whats next to fix red squiggly

umbral saffron
#

already ahead, used the same trick to fix the last one 😎

rotund crag
#

Hows it goin

umbral saffron
#

hey

rotund crag
#

You just saying hey?

#

I meant like hows the fixing coming

#

i wasn't just saying 'sup' 😄

umbral saffron
#

oh i just told you

#

that i used the saem trick

rotund crag
#

oh, gotcha, i thought you were fixing the other ones

umbral saffron
#

nah

#

now onto fixing the big problem

rotund crag
#

so whats next, any sqigglies?

umbral saffron
#

0

rotund crag
#

Are is it seemingly working at this point again

#

Nice

#

And do you have the same bug as before

#

can you verify all the code is working the same as before all of this

umbral saffron
#

well we took out the insane stuff so im guessing it is toggling but i cant tell because the thingwas taken out

#

ohhhh

#

works just the same

rotund crag
#

cool.

#

So toggling is working

#

now you can write some simple logic to say
if (im insane)
do this stuff
else
be sane

#

Give me an updated script btw

#

if you still want help

#

so I am where you are current

umbral saffron
#

brb

#

sry gtg

rotund crag
#

all godo

#

good luck1

umbral saffron
#

hey

#

@rotund crag

rotund crag
#

Hey

umbral saffron
#

wassup

#

i was hoping maybe you could help me figure out how to make the player move itself, cause I think that i might have to switch off the moving being = to the input

#

but im not sure how to go about that

rotund crag
#

Ok so you know how to do most of this I think, minus maybe the movement itself.

You need to write some logic in update now saying what happens when insane vs sane

umbral saffron
#

oh gotcha

rotund crag
#

Write the general structure first. You can use comments as placeholders for the little details

#

Lemme know if you need a nudge

#

In the right direction

umbral saffron
rotund crag
#

That's pretty much it you got it

umbral saffron
#

cause from what i learned, with the spr rule, i should perhaps make a seperate function for the out-of-control movement and turning

rotund crag
#

Yupp and what class should handle all the movement?

umbral saffron
#

see thats where im at a crossroads because one one hand: the insane class handles insane stuff, but at the same time the playermovement class handles movement

rotund crag
#

So this is a good thought you jad

umbral saffron
#

thx

rotund crag
#

The insane class only handles whether or not something IS insane.

Not what happen when insanity happens if that makes sense

umbral saffron
#

gotcha

rotund crag
#

If you put some movement into the insane class you'd have the same problem as yesterday

#

In that now you've got some other class handling movement and that doesn't make much sense

umbral saffron
#

yeah

rotund crag
#

My advice - get the input movement working

#

That's easier

umbral saffron
#

thats what that would be

#

and im thinking that I have to somehow switch it from that to just a codeable action(moving)

rotund crag
#

Technically that's sprinting not just regular moving no?

umbral saffron
#

oh

#

well thats the only time i see that input.getaxis

#

not acis

#

axis

rotund crag
#

I'd honestly comment the sprinting out till I got regular movement working, gotta do one thing at a time and just keep building out

umbral saffron
#

ok

rotund crag
#

I'm on my phone btw so much harder to type and I don't have your classes in view like yesterday

umbral saffron
#

yeah that also houses the movement. tf? weird

#

oh thats fine

rotund crag
#

Did you get the sprint code from a tutorial

umbral saffron
#

yup im pretty sure i copy and pasted

#

lmao not the best idea

rotund crag
#

For the sake of learning I agree

umbral saffron
#

yeah

rotund crag
#

I bet you could make your own, simpler sprint from scratch

umbral saffron
#

yeah

rotund crag
#

It'd be really simple once you got some basic movement up and running

umbral saffron
#

lemme see what i can cook up

rotund crag
#

You already know how to grab input so you could grab the shift key

#

Ok

umbral saffron
#

do you think i could be on the right track? im just scratching my brain for some kind of variable that would be needed to be set to each input axis

rotund crag
#

Dang wtf

#

30 mins flew by

#

So let's talk about naming again. What kind of variable would isMoving be good for?