#⌨coders-cave

1 messages · Page 45 of 1

astral basin
#

i changed void to function and Debug.Log to console.log and now it's js

#

you can put it into your browser console

hasty bane
#

alright

astral basin
#

however

#

my example is totally flawed in javascript

#

if i remember correctly

#

ah i remember what it was

#

yeah it's totally flawed in javascript

#

it has a completely different behaviour

#

var i just takes the last i actually

hasty bane
#

hm

astral basin
#

so it seemed to work the same way as in c#

#

but that's because i was setting var i = 0

#

but that's misleading

function someMethod() {
    {
        var i = 0;
        i++;
        console.log(i);
    }
    // i DOES exist here
    {
        var i; // this i is NOT a new var
        i--;
        console.log(i);
    }
    // i DOES exist here
    var i; // this i is NOT a new var
    i++;
    console.log(i);
}
someMethod();
#

i remember debugging something that fell for this

#

you expected a local scope like in c# but it actually took over the var from the previous scope

#

deadly

#

in javascript it's called shadowing i think

#

so you have global scope, local scope and variable shadowing

#

different concept as in c#

trail ocean
stark ravine
#

🗿 the title make it sound like an investigation series

bold rover
#

The name of steam work shop tho ...

keen shell
#

Sends me to nowhere

trail ocean
stark ravine
#

🗿

keen shell
#

How do you do that accidentallyxzibit

trail ocean
#

but don't worry, uploaded again :p

stark ravine
#

Is it the new vehicle mod

trail ocean
#

no

#

no more god damn vehicle mod

stark ravine
#

🗿 so what's this

stark ravine
empty jacinth
fiery egret
#

What's the difference between int and float

#

0.1

wet girder
#

intergers are whole values and floating points can have decimals

fiery egret
#

I was making a corny coding joke

#

I knew I'm just lonely

fiery egret
#

And I remember the "difference" in math also meant subtracting

hoary hound
fiery egret
north dune
orchid frigate
#

what code needs 28 digits to function

keen shell
fierce epoch
#

ok

orchid frigate
#

ok so

fierce epoch
#
public Rigidbody2D rb;
#

this

#

is a variable

orchid frigate
#

yes

#

this is a refrence

fierce epoch
#

creating a variable

orchid frigate
#

to a rigidbody

#

2d

fierce epoch
#

and is using the reference Rigidbody

orchid frigate
#

yes

fierce epoch
#

2d

#

yes

#

so

orchid frigate
#

that too

fierce epoch
#

if i'm using this script

#

on an object that doesn't have the Rigidbody2D, i will get an error ?

orchid frigate
#

as long as it doesnt have switch and enum i will understand the script

fierce epoch
#

._.

fierce epoch
#

why

orchid frigate
#

because you are referencing a rigidbody

#

not the rigidody

#

you could put the script on a cube with no rigidbody and refrence it to another cube

fierce epoch
#

yes but using this script on an object i'll reference it to the rigidbody2d of this object ?

fierce epoch
orchid frigate
#

ok so here is an example

fierce epoch
#

ok

#

wait

#
using UnityEngine;

public class PlayerMovement : MonoBehaviour
{
    public float movementSpeed;
    public Rigidbody2D rb;

    float mx;

    private void Update()
    {
        mx = Input.GetAxisRaw("Horizontal");
    }

    private void FixedUpdate()
    {
        Vector2 movement = new Vector2(mx * movementSpeed, rb.velocity.y);

        rb.velocity = movement;
    }
}

#

let's say i have this

orchid frigate
#
public RigidBody2D rb;
fierce epoch
#

i'll reference to the rigidbody of the object with this script

orchid frigate
#

ok ait wrong thing

fierce epoch
#

not the rigidbody of another object

#

?

orchid frigate
#

yes

#

when you put public

fierce epoch
#

pand

#

panda

#

wait

#

i need to verify worldbox update

orchid frigate
#

where the script is there should be a little window where there is a refrrence to the rigidbody

#

for the rigidbody*

#

then you drag teh rigidbody into that window

#

doesnt matter from what object

#

and boom

orchid frigate
# fierce epoch ```c using UnityEngine; public class PlayerMovement : MonoBehaviour { publi...

lemme show you something else

using UnityEngine;

public class Movement : MonoBehaviour
{
    public float moveSpeed = 1;
    public Vector2 moveVelocity;
    public Rigidbody2D rigidbody1;
    void Update()
    {
        Vector2 moveInput = new Vector2(Input.GetAxisRaw("Horizontal"), Input.GetAxisRaw("Vertical"));
        moveVelocity = moveInput.normalized * moveSpeed;
        rigidbody1.MovePosition(rigidbody1.position + moveVelocity * Time.fixedDeltaTime);
         
        
        
    }
}
#

very very basic movement script

#

usually i use character controller but here i cant use that

#

as i need to have colliders and triggers and yatty yatty yatta

#

the point is

#

idk what it is

#

also if you want a combat script or atleast a representation of one i can give one to you

north dune
#

bUt WhAt If My CoNtRoLlEr IsNt PlUgGeD iN

#

or is that taking mouse axis

#

wouldnt think so but shrugR

orchid frigate
#

suprisingly enough this is working just as well as if i were to use character controller

north dune
#

i think its almost the same code for 3d mod camera rotating

#

seems simple and perfect

orchid frigate
#

kinda i think

#

the camera rotating in 3d is complicated

#

using alot of math and stuff

north dune
#

naw

#

sec

#

well i mean.. behind the native unity functions yeah probably

#

but its about as easy as what you showed

orchid frigate
#

the cool thing about it is that you dont have the code that yourself

north dune
#

exactly

orchid frigate
#

you can use the...

#

thing

#

for camera

#

i dont remember its name

north dune
#
float x = rotationRate * Input.GetAxis("Mouse Y");
float y = rotationRate * -Input.GetAxis("Mouse X");
Camera.main.transform.Rotate(x, y, 0);
orchid frigate
#

machinima camera controller

#

ay that works too actually

north dune
#

downside is if you want extra stuff like angle locking... THAT you have to make yourself

fiery egret
#

Could I make a rigid body move by mouse instead of the normals controls on the keyboard? Like a floaty type movement.

north dune
#

i think you could use what i just showed right?

#

Input.GetAxis("Mouse Y"); and Input.GetAxis("Mouse X");

#

instead of the axis you used before

orchid frigate
north dune
#

yeah

orchid frigate
#

i cant

keen shell
# fiery egret Could I make a rigid body move by mouse instead of the normals controls on the k...
public class DragObject : MonoBehaviour
{
    private Vector3 screenPoint;
    private Vector3 offset;

    void OnMouseDown()
    {
        screenPoint = Camera.main.WorldToScreenPoint(gameObject.transform.position);

        offset = gameObject.transform.position - Camera.main.ScreenToWorldPoint(new Vector3(Input.mousePosition.x, Input.mousePosition.y, screenPoint.z));

    }

    void OnMouseDrag()
    {
        Vector3 curScreenPoint = new Vector3(Input.mousePosition.x, Input.mousePosition.y, screenPoint.z);

        Vector3 curPosition = Camera.main.ScreenToWorldPoint(curScreenPoint) + offset;
        transform.position = curPosition;

    }
}
#

I used that

orchid frigate
#

because im not changing the camera, im changing the movement of the player

#

i mean i could

#

but then the player would move whenever the mouse moves

north dune
#

well thats what the guy was asking

north dune
#

sorry it was a little confusing lol

orchid frigate
#

ah that question

#

i didnt understand it at first but now i do

#

yea im pretty sure that how you do it

fiery egret
#

Phone died before I got to read cody's response

fiery egret
orchid frigate
#

ah this seems interesting

#

it would be a really cool weapon

fiery egret
#

I wanted to try something new. Maybe I might add tiny NPCs that will try to break the weapon or react

orchid frigate
#

in their attempt to break the weapon they will be demolished lol, this sounds really cool

fiery egret
#

I got inspired by kick the buddy game and wanted to "expand it"

orchid frigate
#

kick the buddy is amazing in terms of weapon ideas, but the physics on there arent all that great

#

i mean they arent bad

fierce epoch
#

nice there is still a conv here

#

i need to ask something

orchid frigate
#

but there are some things that can be improved

#

ask away

fierce epoch
#

is doing something working on a server

#

so

#

online

#

hard

orchid frigate
#

i have never made an online game

#

so cant help there

keen shell
#

Cody might be interested to take part in this conversation

orchid frigate
#

yes

keen shell
#

he did online stuff for worldbox

fiery egret
#

I heard it's a new hell from a friend but other than that's out of my knowledge.

orchid frigate
#

to my knowladge he is working on sowmthing similar

fiery egret
orchid frigate
#

im thinking of streaming some coding here, but dont know if i should

#

because not many people are interested in coding

keen shell
fiery egret
fiery egret
orchid frigate
#

not sure i just know he is working on somehting similar

fiery egret
#

What if two or more online gods made separate civilizations and set them to war to see who would win. That sounds cool in my head

orchid frigate
#

it would be cool yea

north dune
#

oh

fiery egret
#

People would probably cheat with bubble though

north dune
north dune
#

so far its smooth but ill run into a wall at some point with performance and then the fun really starts

fierce epoch
#

cody

north dune
#

mod is also very easily converted to other games

#

ive already tested connecting from one game to another, can send commands/chat messages just the same

fierce epoch
#

how are you doing the connection

#

using a server

#

the pc ?

north dune
#

unet, peer to peer/pc is server yes

fierce epoch
#

hmm ok

fiery egret
fierce epoch
#

and is it taking much resources ?

north dune
#

the idea right now is for one world/computer to host and be the facilitator of commands for everything else

fierce epoch
#

cuz i want to make a game based on a game i did on Discord

#

but the fact is that discord is hosting the game

#

so

north dune
fierce epoch
#

there is so many stuff i'm wondering cuz damn idk how to start

north dune
#

not noticable difference yet

#

but i cant speak on the ping/lag, i have only tested local connections

north dune
#

and one single online test

fierce epoch
#

hmmm

north dune
#

which was early, before there were any commands/actions being done

#

the source for this mod will be public as soon as im comfortable posting the mod itself

fiery egret
north dune
#

currently im sending commands as strings that get converted into commands and parameters on the clients

#

theres bound to be plenty of ways to optimize how that happens

#

client does an action like click to place a radius of dirt
client sends this action to the host so the host will mirror it on everyone elses client
host parses the action, executes it on host world, relays it forward
other clients parse the action, execute it on their world, send a response if necessary

#

im relatively confident so far but eventually something will come up

fierce epoch
#

cody

#

do you know any place i can find cool texture

#

other place than unity asset store

north dune
#

Not really, most of the stuff I've played around with husband off of Google searches and not exactly legal all the time

#

Has been*

orchid frigate
#

so anyone have any idea for how i can randomize what items spawn if i have ALOT of items, kind of like in binding of isaac? i can think of some ways but they would require me to go over every item

fierce epoch
#

i would have an idea

#

but like

#

with my python knowledge

#

i guess it's also possible in C sharp

#

where do you store your items

orchid frigate
#

my first idea was to give every item a tag that is a single digit, make a random intrange and whatever item i get i instantiate

fierce epoch
#

items

orchid frigate
# fierce epoch items

this scares me, dont tell me i will have to write out every single one in a script or something

fiery egret
fierce epoch
orchid frigate
#

we shouldnt ping him this freely,after all he probably has his own work

fierce epoch
#

or just give them a tag

#

a number

#

and random int something

orchid frigate
#

the problem is

#

right

#

the instantiating part

north dune
#

list.GetRandom?

#

list of item names or whatever, then pick one at random before doing what you need

fiery egret
orchid frigate
#

because i get this random number, i get what item i want but then how do i instantiate it, how do i get its name

#

my first thought was that it would have a very simple single digit name

#

that is the same as its tag

orchid frigate
north dune
#

because i get this random number, i get what item i want but then how do i instantiate it, how do i get its name
why cant the name be the number? if you need a different string to display for like a name tag or something, give it a new ID string or something

#

if the name = number, you could just do like you already said and random a number and get the item from that, which is a bit easier than list.GetRandom

#

and i promise im not a great coder, i give shit advice plenty often, ask @keen shell how many times ive wasted his time

#

lmao

fiery egret
#

Hahaha

north dune
#

take what i say with grains of salt and google often

fiery egret
#

Google is built different

north dune
#

why cant the name be the number? if you need a different string to display for like a name tag or something, give it a new ID string or something
worldbox uses libraries like this

you could have a similar library of items that applies an id/number as theyre set up

fiery egret
#

Haydot is typing a essay in MLA format

north dune
#

will respond eventually most of the time

orchid frigate
#

so it would work sorta like this:

void OnCollisionEnter(Collider2D collider){
  if(collider.gameObject.tag == "player"){
    public IntRange item = new IntRange(0, itemCount);
    Instantiate(dont know how to get the name here, transform.position);
north dune
#

yes

#

exactly

#

i dont use object.instantiate like ever, so i dont have any advice on using it :/

#

the times ive used it i already had an object to copy from, if im creating a new object id do it differently

orchid frigate
#

alright well you guys helped me enough, i just need to figuere out how to put the name in there and i will almost be free from this script

north dune
#

hell yeah

orchid frigate
#

then i have to make the 10 times more compicated script

#

which is generating rooms and dungeons

keen shell
north dune
#

youre too sweet to say i wasted your time with the attempt at code help

#

haha

#

conversations are always nice either way, but all those times im like "do this! try that! maybe this is a better idea" and it was just a fail

orchid frigate
#

talking to people about code is always nice while coding, it gives you motivation to keep going and lets you take a break from all those floats and ints

north dune
#

for sure

#

just writing out what my problem is helps me figure it out a lot

#

will start bitching to someone and stuff will click while im typing to them

fierce epoch
cedar plinth
#

what programming language is used in world box?

north dune
#

c#

cedar plinth
#

nice

knotty root
#

007!help

broken elm
#

Ha

wary flax
#

Hippity Hoppity, your code is now our property

bold rover
#

You're not wrong...Most coding work is just Borrowing other people codes (Mostly in AI, ML development)

north dune
#

most of the things you think or do have been done before, same goes for code
for some things its way better to use someone elses work than redo it all

bold rover
#

You have other problems then questioning if it fine to use someone else code...So Yeah, You do you

fierce epoch
#

why can't i use a double in Vector2

barren shale
#

Cuz they take more memory and the accuracy isnt needed in game development

#

At least that's what i think

fierce epoch
#

hmm

#

i'm new to C sharp and i can't find how to move something smoothly without using Force

barren shale
#

2d or 3d ?

fierce epoch
#

2d

barren shale
#

What do you mean move smoothly

#

Like doesn't stop immediately

#

Or is it just jittering when its moving and u dont want that

fierce epoch
#

i mean

#

when i use translate

#

for example

#

my object is just teleporting

#

not moving

barren shale
#

And why is that a problem

fierce epoch
#

i'm just looking for it, now for a dumb example but i want to make it later for something else

#

for example

#

The script will move an object to the left

#

for like

#

16

#

from x 0 to x 16 for example

barren shale
#

So

#

First you need to multiply the movment speed by deltatime

#

Do you know what that is

#

?

fierce epoch
#

yes

barren shale
#

Then you can just use translate

#

Make the number small so it looks smooth

fierce epoch
#

welp let me send a very very little code

barren shale
#

U can make it like a velocity and add a decay for a delayed stop

#

And i suggest making your own collision system

fierce epoch
#

this is

#

uh

#

the thing

#

it's very small and don't mind why i run the code on a collision event

#
using UnityEngine;

public class PlayerMovement : MonoBehaviour
{
    public float movementSpeed;
    public Rigidbody2D rb;

    float mx;

    private void Update()
    {
        mx = Input.GetAxisRaw("Horizontal");
    }

    private void FixedUpdate()
    {
        Vector2 movement = new Vector2(mx * movementSpeed, rb.velocity.y);

        rb.velocity = movement;
    }

    void OnCollisionEnter2D(Collision2D collision)
    {
        print("Test");
        transform.translate(-16, 0, 0)
    }
}
#

i think this was my code

barren shale
#

Youre not using deltatime

fierce epoch
#

idk how to use it correctly

barren shale
#

Just multiply the speed by it

#

And you dont need the collision event

#

Because you're using a rigid body and velocity

fierce epoch
#

no i mean

#

i'm using the collision because

#

i want my object to go on the left when it collides with the ground

#

but

#

it's just to test

barren shale
#

Oooh

#

U want it to go to the left smoothly

fierce epoch
#

yes

barren shale
#

Hmm

#

So when it touches the ground

#

You want it to go to the left

fierce epoch
#

yes

barren shale
#

Cant you just override the velocity

fierce epoch
#

it's just a cube

fierce epoch
barren shale
#

Make the velocity -16,0

fierce epoch
#

so

#

uh

#

rb.velocity = ... (-16, 0, 0)

#

?

barren shale
#

Yeah

#

But multiply that by deltatime

#

Always

#

So it's the same every time

#

Or no

#

Wait

fierce epoch
#

ye ?

#

it's not like

#

Time.deltaTime ?

barren shale
#

Yea

#

But you dont have to use it

#

On velocities

fierce epoch
#

i mean idk why i would use it yeah

barren shale
#

Just when you're mocing the object directly

#

Im a bit rusty with unity

#

Its been like 1 year

fierce epoch
#

i know it's probably wrong

#

but

#

this

#

what do i put before

#

the

#

(

#

)

barren shale
#

New vector3

#

Or 2

#

Not 3

fierce epoch
#

but if i'm in 2d i could use Vector2

#

yes

#

okey

barren shale
#

Now theres a problem with this

fierce epoch
#

yes

barren shale
#

If you try to move while its throwing you to the left

#

You will stay on the ground

fierce epoch
#

i got an error anyway

barren shale
#

What does it say

fierce epoch
barren shale
#

You forgot new

fierce epoch
#

ohhh ye

#

i'm dumb

#

sorry

barren shale
#

Don't worry youre still new it will click one day

#

Even to this day i use ; in python

#

I cant stop

fierce epoch
#

i'm from python

#

so

#

i always forget the ";"

barren shale
#

And the {}

fierce epoch
#

ye

barren shale
#

Instead of tabs

fierce epoch
#

oh well now i have no errors but it ain't moving

#

let me just

barren shale
#

Does it say test

fierce epoch
#

see if i cannot change some properties of the ground

#

yes

barren shale
#

But its not moving

#

Oh

#

So ehen you dont click any key

#

The mx is 0

#

So every frame

#

Your velocity is being set to 0

#

So even when u change it

#

It will be back at 0

#

That's why

#

When i make 2D games i dont use unity physics

#

So

#

Hmm

fierce epoch
#

oh no

#

my keys are working very well

#

but the collider script not really

#

😄

barren shale
#

Yea i know

#

Wait

#

Lemme think a bit

#

Ok

#

So

#

You have to delete everything in the script

#

Rework time

#

Did you do that?

fierce epoch
#

._.

#

so i delete everything ?

#

i mean there is not many stuff in it

#

but why

barren shale
#

Rework

#

Thats what rework mean

#

Instead of using a rigidbody

#

Which is bad in 2d

#

You're gonna make you're own collision and movement system

fierce epoch
fierce epoch
barren shale
#

Its not that hard

#

First

#

You need your horizontal and vertical velocity

#

Just make two floats

#

Hs and vs

#

Or what ever u wanna name them

fierce epoch
#

public i guess

barren shale
#

Private

#

Actually

fierce epoch
#

ah

#

why

barren shale
#

Because you're not gonna access them from outside the class

#

And go to your object

#

In the inspection tab

#

And make the rigidbody

fierce epoch
#

okey

barren shale
#

Kinematic

fierce epoch
#

what's the difference between kinematic and static

#

static don't move

#

and kinematic isn't impact by gravity ?

barren shale
#

Yea static dont move

barren shale
#

That's why i want to ask you

#

Does it still fall?

fierce epoch
#

nope

barren shale
#

Nice

#

Saves work

#

Now make a public float

#

Or two

#

One is called speed

#

And the other is called gravity

#

Set them to one

#

Youre gonna chnage them after

fierce epoch
#

ok

barren shale
#

Now lets make it fall

fierce epoch
#

so

#

vertical force

barren shale
#

So gravity adds up as you fall

#

But

#

It doesnt keep adding up

#

There's a terminal speed

#

You might wann add another float called terminal speed

#

All done and ready to implement gravity?

fierce epoch
#

i'm following your instructions for now and trying to understand what i'm doing

barren shale
#

You will get it more when we finish

#

So

fierce epoch
#

is this what you wanted sir

barren shale
#

Yes indeed

fierce epoch
barren shale
#

So

#

void Update()

#

Add the update method

#

Dont forget the {}

fierce epoch
#

is method in C# = Functions in Python

#

?

#

lol

barren shale
#

Yes

fierce epoch
#

ok

barren shale
#

But the update method is implemented by unity

#

It runs once every frame

fierce epoch
#

ye

#

btw

#

what's the difference between FixedUpdate and Update

barren shale
#

Update runs every frame

fierce epoch
#

i have heard FixexUpdate is better for physics stuff

barren shale
#

FixedUpdate runs every 0.2 seconds

#

So its frame independent

#

Which makes it better for physics indeed

fierce epoch
#

oh ok

barren shale
#

But we are going to use deltatime so it doesnt matter

fierce epoch
#

okey

barren shale
#

Ok

#

So

#

Every frame

#

You add the gravity to vertical speed

#

So it will look something like
vs += gravity;

fierce epoch
#

i just like in update put : c vs += gravity;

#

?

barren shale
#

Yes

fierce epoch
#

it i do gravity the vertical speed will increase everytime

#

no ?

barren shale
#

Yes

#

But dont worry about that

#

Now

#

Lets see if its working

#

After adding the gravity

#

Write

#

Transform.Translate(new Vector2(0, vs));

#

Done?

fierce epoch
#

yes

barren shale
#

Now run it

#

You will notice

#

That youre object is going up

#

And it becomes very fast

#

Is that what happened ?

fierce epoch
#

no i got an error and i try to solve it

barren shale
#

Ok

#

Xd

#

What does it say

fierce epoch
#

but

#

i got an error

#

Expected ";"

barren shale
#

Ok

fierce epoch
#

and i have a ";"

#

so

barren shale
#

First

#

Its a method

#

Not a property

#

You cant use = on a method

#

You cab call a method

#

It shouls be like this

#

transform.translate(new Vector2 (0, vs));

fierce epoch
#

Assets\Scripts\PlayerMovement.cs(14,19): error CS1061: 'Transform' does not contain a definition for 'translate' and no accessible extension method 'translate' accepting a first argument of type 'Transform' could be found (are you missing a using directive or an assembly reference?)

barren shale
#

I think its a capital T

#

Translate

fierce epoch
#

okey

#

it's going very high

#

very fast

barren shale
#

Ok

#

So first

#

You see that +=

#

Make it -=

#

So it goes down

#

And in the Transform.Translate line

#

Next to vs

#

Write * Time.Deltatime

#

The D should be d

#

I think

#

It should autocorrect

#

Wait

#

Is it not autocorrecting anything unity related

fierce epoch
#

wow it false so fast

#

fall

fierce epoch
barren shale
#

Ok

#

So its falling fast

#

Because theres no terminal speed

#

So we need to check if the speed is above the terminal speed

#

So before the transform.translate

fierce epoch
#

i think it's so fast the game can't calculate the collisition with the ground xzibit

barren shale
#

Its not

#

There's no collision

#

We'll do that later

fierce epoch
#

or it's just going through

#

also

barren shale
#

Go ahead

fierce epoch
#

what do you mean by terminal speed

barren shale
#

It's the maximum speed an object can fall by

#

So you dont just keep speeding down

fierce epoch
#

is it not comparting vs and terminal speed

barren shale
#

When you reach the terminal velocity youre acceleration is basically 0

fierce epoch
#

instead of speed and terminal speed

barren shale
#

I don't get what youre trying to say

fierce epoch
#

so

fierce epoch
#

what i got now is

#
public class PlayerMovement : MonoBehaviour
{
    private float hs;
    private float vs;
    public float gravity;
    public float speed;
    public float terminalSpeed;
    
    void Update()
    {
        vs -= gravity;
        if (terminalSpeed < speed)
        {

        }
        else
        {
            transform.Translate(new Vector2(0, vs * Time.deltaTime));
        }
        
    }
}
barren shale
#

First

#

You dont need that else statement

#

You want to keep falling

#

But you want your speed to be constant

#

And

fierce epoch
#

should i put the vs -= gravity in the if condition

barren shale
#

Nope

#

You dont want to check if speed is bigger than terminal speed

fierce epoch
#

it will still increase the speed of falling then no ?

barren shale
#

You will see after

fierce epoch
barren shale
#

But with speed

#

I mean youre vertical speed

#

The public speed field will be used for moving horizontally

#

So use vs instead of speed

#

Done ?

fierce epoch
#

okok wait

#

let me try to figure out what you're saying

#

cuz

#

i'm dumb

barren shale
#

Its hard to write on mobile

#

Hmm

fierce epoch
#

np

barren shale
#

How do i explain thsi

#

Basically

fierce epoch
#

first of all

#

is this what you basically wanted as condition

barren shale
#

Ok go ahead

fierce epoch
#

or did you mean another comparaison

barren shale
#

Let me ask you a question

#

What do you think we are going to use the publick field speed for ?

fierce epoch
#

for the speed of the character

#

the player

barren shale
#

Does the player control his vertical speed ?

fierce epoch
#

no

barren shale
#

So its the horizontal speed of a player

fierce epoch
#

wait

#

uh

#

wait

barren shale
#

But its not even a speed

#

I dont know why i called it speed

#

Its basically the horizontal acceleration

#

You might wanna change it to acceleration instead of speed to avoid confusion

#

Or you can keep it

fierce epoch
#

I have the horizontal speed and the vertical speed, the vertical speed is to calculate the speed of the falling

#

the speed is the speed of my player

barren shale
#

Oh wait

#

Im dumv

#

Yes its speed

#

Yes its the speed of your player

#

Ok

#

Terminal speed should be a negative number

#

Cuz falling is considered negative

#

So change ot to -1 instead of 1

#

All done and ready to continue?

fierce epoch
#

not really

#

i have

#

to test

#

set the gravity to 9

barren shale
#

No need to make it realistic

#

When we are done you can play with the numbers

#

Until it feels natural

fierce epoch
#

ok so let's say i put it on 1.5

#

no

#

2

#

on 2

#

what should my terminal speed be

#

-3 ?

#

something like that

barren shale
#

Idk

#

You just have to play with the numbers

#

When we are done

#

Until you like how it feels

#

Are you ready ?

fierce epoch
#

ok

#

uh

#

i don't know why to use my if statement yet

#

and what to put inside

#

and what to compare

barren shale
#

So

#

The last pic u send me

#

Is correct

#

Inside the if statement

#

Set the vs to the terminal speed

fierce epoch
#

wait so let me resume

#

every frame , i do vertical speed - gravity

#

if my vertical speed is higher than my terminal speed

#

i set the vertical speed to the terminal speed

barren shale
#

Yes

fierce epoch
#

and i apply the translation

barren shale
#

Yes

fierce epoch
#

ok

barren shale
#

Basically youre vs cant get under your terminal speed

#

So tou cant fall faster than your terminal speed

#

Go test it

fierce epoch
#

ok now it's falling

barren shale
#

Not very fast?

fierce epoch
#

let me show u

keen shell
#

You guys have been talking here for so long, very niceripbre

barren shale
#

xd

fierce epoch
#

ye hamza is giving free Unity courses

barren shale
#

I have a lot of free time and im bored af

keen shell
barren shale
#

Make the gravity like 0.1

#

And run it again

keen shell
#

Is gray supposed to be a floor?

barren shale
#

I think so

fierce epoch
barren shale
#

Now you can see

#

Ok lets implement horizontal moving

#

Then collisions

fierce epoch
#

ok

barren shale
#

First comment the transform.translate part

#

So the cube dont fall out od the screen immediately

fierce epoch
#

//

barren shale
#

Yes

fierce epoch
barren shale
#

Write that before it

#

Itll look green

fierce epoch
barren shale
#

Because there's no collision the cube will fall out of the screen and you cant test horizontal moving

#

Dont worry when we are done you can uncomment it

fierce epoch
#

OooH ok

#

i thought you wanted me to comment the code

#

not canceling it

barren shale
#

Get me a picture of the whole script

fierce epoch
barren shale
#

Ok all looking good

barren shale
#

All on the same frame

#

So it looks smooth

keen shell
#

Oh so for smoothy

fierce epoch
#

just

#

i'll have to go to a tennis course

#

soon

keen shell
#

why not add a simple collision while testing and improve later tho?

barren shale
#

Dont worry

#

We'll implement a simple version bod what i said first

#

It wont be very good

#

Ok lets continue try to finish as much as we can before you have tongo

#

So now you want to check what keys you have pressed

#

If A go left else if D go right Else dont move

fierce epoch
#

yes

barren shale
#

So write the first if statement

#

In it you need

#

Input.GetKeyDown("a")

#

This is the condition

#

Before we fill it in you can erite the other if statement

fierce epoch
#

what's the difference between GetKey and GetKeyDown

barren shale
#

xd

#

I forgot

#

Lemme check the documents

#

Havent used unity in a year

keen shell
#

Getkeydown sounds like it updates when the key is being pressed
Get key sounds like an activation that happens once or twice but I'm not sure

fierce epoch
#

@barren shale i'll have to go now ^^

barren shale
#

Ooh

#

Ok

fierce epoch
#

but

barren shale
#

I remembered the difference

fierce epoch
#

i got this

keen shell
#

Bey

exotic vessel
#

Soo this is where all the nerds go

fierce epoch
#
if (Input.GetKey("d"))
{
            
}
if (Input.GetKey("q"))
{
            
}
keen shell
barren shale
#

Yes its GetKey

#

Not GetKeyDown

#

Its actually thw opposite of what daniel said

keen shell
#

Oh really lmao

barren shale
#

GetKeyDown runs once

#

GetKey keeps runnings as long as you are holding rhe jey

fierce epoch
#

oh okkk

#

welp

#

thanks for help

#

imma go

barren shale
#

Np

fierce epoch
#

can i add u friend ?

barren shale
#

Sure

main brook
#

what language can we use to make worldbox mod

#

first of all am i in the right channel what

stark ravine
#

C#

main brook
barren shale
#

Just wear glasses and you can C#

#

Hahaha

#

Classical C# dad joke

#

Intensefies

sly schooner
#

For more awful jokes, dance tango with a mango

main brook
#

i already use glasses

#

and i can already C#

main brook
#

how does one send and receive packets from 1 machine to another machine

#

rather confusing for me

#

how do things like socket work inside it

#

the sending the actual bytes

#

bytes into radio waves or something and into bytes again

barren shale
#

Bro

#

Bits

#

0 or 1

#

High frequency electricity or low frequency electricity

wet girder
#

networking is weird

barren shale
#

Its weird

wet girder
#

people dedicate their whole lifes to it and still don't understand it all in some cases

#

but it's super super super important

#

especially wireless which is the weirdest thing in iy

main brook
#

i forgot its just electricity

main brook
#

it would be easier and less latency with cable connection

wet girder
main brook
#

its basically super super small electrical current

wet girder
barren shale
#

How would the cpu work

#

With no electricity

main brook
#

transistor

#

oh

barren shale
#

I thought it was like this

main brook
#

basically just a piece of metal

barren shale
#

But rhen i read about it

main brook
#

but hey atleast fast latency

wet girder
main brook
#

or a super busy executive

wet girder
#

it doesn't process bits mostly

main brook
#

i believe it just follows instructions

#

of bits

barren shale
#

Its more complicated than that

wet girder
#

it reads ram which has those instructions and runs them. Or this is the basics of iy

main brook
#

ram are just harddisk

wet girder
#

it's way more complicated but it's not important to know much better

main brook
#

except faster

wet girder
#

actually no

main brook
#

but inconsistent

#

as data just flows

#

or sumtin

wet girder
#

it's way too hard to explain ngl

main brook
#

yes

#

low levels are always hard

barren shale
#

Go read a book about it

main brook
#

im poor

wet girder
main brook
#

i already did that

barren shale
#

Way better than asking someone to explain

wet girder
main brook
#

i watched bunch of random crap

#

about bytes

#

and low level things

#

even to the point of how electric flows

#

in a gaming way

barren shale
main brook
#

more ram = more performance

barren shale
#

Oh yes

main brook
#

better gpu = better graphics

barren shale
#

Downloading ram

main brook
#

yes yes

#

i did that as a kid /s

wet girder
main brook
#

yes like cpu

#

if the cpu is weak

wet girder
#

I personally have 20 gigs for ram but you don't really need that much

main brook
#

it doesn't help much

main brook
#

i only have 2-4

wet girder
#

lol

barren shale
#

Have two 4gb is better than having one 8gb like me

wet girder
#

I only use like one fourth of my ram usually

main brook
#

and i use 100% of it

wet girder
#

but when I code it might go to like 12 gigs used

main brook
#

how

barren shale
#

Wtf ur coding

#

Ai

barren shale
#

Shit

main brook
#

are you making

wet girder
#

I just have like 100 chrome tabs open

#

it eats my ram

main brook
#

find square root of ur mom

barren shale
#

Only AI would rake that much ram

main brook
#

*sniffs*

wet girder
#

I like GitHub

main brook
#

i like git

#

i don't like github

#

but i like git

wet girder
#

do you use gitlab then?

main brook
#

no

wet girder
#

GitHub and gitlab are the 2 I know

main brook
#

i use github

#

but not often

#

just when i need to TEACH THIS KID HOW TO USE GITHUB EVEN THOUGH I HATE USING IT

#

oh wait let me connect my account to github

barren shale
#

Just use github desktop

#

Make life simpler

wet girder
#

I use git in bash because I use WSL for coding

#

well mostly for coding @bitter sedge but still

main brook
#

eh it says failed to connect

main brook
#

i use my phone

#

i can't afford a pc so i use my phone

barren shale
#

Wtf

wet girder
#

damn

barren shale
#

Programming on phone

wet girder
#

it's actually relatively easy

barren shale
#

U just said u had two 4gbs

main brook
#

meh you'll get used to environmental issue, compatibility error, missing permission, lib missing, headers not found, directory conflict

#

also npm will suck your internal storage dry

keen shell
main brook
#

symlink are broken

keen shell
#

How tho?

main brook
#

and binary files aren't running in internal storage

main brook
wet girder
#

It's easy tho to get shitty pc almost free, I used pc I got with 12€ until last week when I bought decent pc

main brook
#

im a minor

keen shell
#

I mean, which way of Coding you do with what kind of app

main brook
#

and my family is having a financial crisis

wet girder
#

Electricity is other thing tho

main brook
#

ah

keen shell
#

Like where do you code on phone

main brook
#

I use Termux with some code editor

#

or just plain text editor

keen shell
#

Visual studio on phone

main brook
#

not available

keen shell
#

Would be nice

main brook
#

unless i install linux with gui

wet girder
main brook
wet girder
#

nope

#

I did actually get vs on my phone

main brook
#

nice

#

i wanna do that

#

but ubuntu took like almost 2gb of my storage

wet girder
#

lemme find the google article I used to help me

main brook
#

and most of my storage are filled with numbers

wet girder
main brook
#

yes

#

they discontinued the play store version

#

now only on f droid

#

with latest update

#

so the newest package doesn't scream at you

wet girder
barren shale
#

Probably start saving from now and get yourself a cheap pc

main brook
#

how to save money

wet girder
main brook
#

i dont even get an allowance

main brook
wet girder
#

No they didn't

barren shale
#

Even if it is 1 euro per day

main brook
#

yes they did

#

no new update in play store

wet girder
#

I have it in play store

main brook
#

only in f droid

#

exactly

#

but no new update

#

its still old

barren shale
#

Don't you get school allowance

main brook
#

newest is in f droid

main brook
barren shale
#

Wtf

wet girder
#

What newest?

main brook
#

why would you give ur kids school allowance for online class

main brook
barren shale
#

Oh online school

wet girder
#

version of what

main brook
#

currently some packages screams at me

#

termux

wet girder
#

ohh

main brook
#

and the

#

pkg install

#

it makes the package old

barren shale
#

How old are you

main brook
#

so no new package will be fetched

barren shale
#

Cant you get a part time job

main brook
main brook