#Summary in first post

1 messages · Page 1 of 1 (latest)

raw mural
#

Summary:

2d game
has slopes that can be on background/foreground

background must be on same physics layer as foreground (and can be placed on top of each other), so that it's easy to design levels
(optional: ground/walls are tiles)
can't disable object/tile itself in case there's something on top of it

holding up should allow player to walk up the slope instead of ahead (optional: and landing on "background" platforms)

what happens when there's a slope DOWN, and a path forward?

forest mica
#

Ok so

#

The steps has two colliders

#

One is triggered by default

#

The other isn’t

#

One of them is enabled

#

The other isn’t

vast parrot
#

Which one is enabled?

#

The Trigger or the regular one

forest mica
#

The one that is triggered

#

Sorry wifi is acting up

#

So I have no idea if you’re still here lol

#

Yeah more like instead of backgrounds it’s two different pathways but yes

#

Yeah

#

I mean it’s steps

#

You’re going up steps

#

Hey is @vast parrot here?

vast parrot
#

Yes I am, I just don't have anything to suggest right now

forest mica
#

Ok

#

Well you asked me to give you my interpretation

#

Okay if you’re available tomorrow wanna just pick this up tomorrow?

#

I really gotta destress

raw mural
#

yeah the thread won't be lost now, don't worry about it

forest mica
#

Ok

#

Thank you both

raw mural
#

you can close the thing on the right and it'll stay just fyi

#

return through the thing under code-beginner

#

an example picture of level would be really nice

#

because i'm sure i've seen that in some game but i can't remember which one

forest mica
#

So this should make it so you can go past the steps if not pressing up right?

#

@raw mural @vast parrot

raw mural
#

why are you disabling one?

#

you'll just fall through the ground

#

btw i thought about it and now there's a bonus question: what's the behaviour when there's a slope down

forest mica
raw mural
#

and most important question is how's your environment made

forest mica
#

You press up and the one collider is supposed to be enabled

#

if not, then it's disabled

#

but it's not working

#

Both colliders are always activated, no matter if I press up

raw mural
#

that's because you have 0 understanding of what you've done

forest mica
#

Hey Spr2 told me to do this

raw mural
#

it's obvious it wouldn't work, but even if it would work then why are you disabling the collider that keeps you on ground

#

i doubt he did, you probably misunderstood

forest mica
#

ok

#

what do you think he told me to do?

raw mural
#

link me

#

or screenshot

forest mica
#

of?

#

our conversation?

raw mural
#

what he told you to do

forest mica
raw mural
#

hmm i don't see how that would work

#

maybe i need to see the rest of the conversation to understand that

#

but it's not like you're doing what he said either

#

in any case i'll continue thinking for now, with the downwards slope and walls included it's a really complicated issue

forest mica
raw mural
#

ohh

#

makes sense

#

but you're not doing that

#

but that's a really scripted way of doing that, i don't like it

#

you know the difference between trigger and normal collider?

#

basically he says that on trigger enter/stay it should check if you're holding up to unset it from being a trigger, so that it becomes a collider, then return back to trigger on collider exit

#

and i see a potential problem there if you press up in front of the slope, you'd potentially get stuck inside the wall

forest mica
#

So...

#

how do I make a collider a child of an object?

spark sentinel
delicate radish
spark sentinel
#

now its child

spark sentinel
#

forget all that

delicate radish
#

ok ok ok

spark sentinel
#

just do it via a trigger

#

that script is dookie

forest mica
#

Do I give it a rigidbody too?

#

the child?

#

probably

spark sentinel
#

you never wanna hard reference colliders like that

raw mural
#

summary is at top, and yes he's clearly a beginner trying to do something advanced so expect a lot of headache

spark sentinel
#

this isn't hard

delicate radish
#

itsok

#

colliders and stuff are hard and annoying and i am 8 years unity experience

spark sentinel
#

thats 2D anyway

forest mica
#

ok

spark sentinel
#

it makes a composite

forest mica
#

So I'll make a script for the child

spark sentinel
raw mural
#

Summary in first post

spark sentinel
#

inside script declare bool for keys

#

inside ontrigger enter you check for tag in collider if its"stairs" and bool is true that key is held then activate stair colliders its toching

#

i assume you already made a player movement script that handles moving on sloped colliders..

spark sentinel
#

ok thats fine

forest mica
#

but it does need some work

#

but i can worry about that later

spark sentinel
#

worry about this system first

forest mica
#

yes

delicate radish
#

i have an example: i have a child object, when you click it enables this object. it has this script on it:
this sciprt is on a child obvject with a collider that will detect colliders in its area while active, and will turn off after an animation is done

spark sentinel
#

you can dynamically set the collider size easily if you use a circle collider 2D

delicate radish
#

mayeb this helps

spark sentinel
delicate radish
#

ok sorry

spark sentinel
#

they're new

forest mica
#

so in the ontriggerenter2d

#

the collider will be disabled?

#

how is this?

spark sentinel
#

wait

#

forgot the bool

forest mica
#

private bool isUp

spark sentinel
#

here like this

raw mural
#

you're essentially destroying stairs if you're not holding up though

forest mica
#

this good?

raw mural
#

and touching the stair collider is bad in general, in case there are enemies on it

delicate radish
#

so what i understand, you want a collider to act as a ramp to make you go upstairs if you are pressing up?

raw mural
#

thread will stay for a week of inactivity so take your time to think about the solution

delicate radish
#

so, you shoudl want collider enabled if isUp is true right?

raw mural
#

@delicate radish and down*

spark sentinel
#

did you look at my image @forest mica

raw mural
#

and ideally they should be on same physics layer

delicate radish
#

small thing, you dont need to do
if (isUp == true)
you can just do
if (isUp)

forest mica
#

And it!

#

....

#

still doesn't work

spark sentinel
#

show the full scene and inspector

#

with new code

#

it works on my end

raw mural
#

nothing good, he disables random collider if holding up above stairs

spark sentinel
#

random collider?

raw mural
#

getcomponent

spark sentinel
#

how's it a "random" collider

forest mica
spark sentinel
delicate radish
#

A

raw mural
#

yeah he tends to do that

delicate radish
#

trying Input.GetKey instead of Input.GetKeyUp

forest mica
delicate radish
#

GetKeyUp only works ont eh frame it is pressed

spark sentinel
delicate radish
#

sorry, right

raw mural
forest mica
spark sentinel
forest mica
#

So Null what am I missing?

spark sentinel
#

what he did in the first script is completely wrong and hard coded... it would never work

delicate radish
#

and you want collilder to be enabled if key is down right? right now you are setting it to disabled if key is down

raw mural
#

literally nothing here would work though

spark sentinel
raw mural
#

oh wait i see what you did there

spark sentinel
#

yes why wouldn't i

delicate radish
#

@forest mica in Update() try this:
GetComponent<Collider2D>().enabled = Input.GetKey(KeyCode.Up);

spark sentinel
#

the radius is also bigger

raw mural
#

yeah that's essentially what SPR2 did but backwards, disabling stairs instead of player component

delicate radish
#

erase the rest of the code

forest mica
#

ok i wont

spark sentinel
#

now u r just trolling

delicate radish
#

its a good test

#

its bad code i know but it will test if its a code problem or a component config problem

spark sentinel
#

alright move on cause trolling isn't helpful and can get u muted

forest mica
#

he's supposed to move through the steps if he's not alright climbing it

delicate radish
#

im not trolling i swear

#

ill stop if im not helpful sorry

spark sentinel
#

please do

#

thanks

spark sentinel
raw mural
#

@spark sentinel there's also the issue of pressing up when in front of stairs and jumping though

#

in this case you'd need to hold up ahead of time and the whole thing isn't ideal if using tiles

forest mica
raw mural
#

that's probably irrelevant for grinch though

spark sentinel
# forest mica

biggger because it has to be ahead of the player when hes walking

forest mica
spark sentinel
raw mural
forest mica
spark sentinel
#

right

forest mica
#

aight then what?

spark sentinel
forest mica
#

it already is?

spark sentinel
#

this is still a wonky way of doing it tho

#

few problem comes, like whathappens when other physics objects collide with slope, should they ignore it..

forest mica
forest mica
#

and projectiles will pass through them

spark sentinel
#

look carefully at ontrigger enter is true

forest mica
#

oh hold on

#

this?

#

yes?

#

Doesn't work so guess not

spark sentinel
forest mica
#

nope

spark sentinel
#

did tag correctly the ladder

forest mica
#

i wonder if there's something that's keeping it from not workin

#

yeah

spark sentinel
#

check console for error

forest mica
#

no errors

#

oh now i get this

spark sentinel
forest mica
spark sentinel
#

it needs Collider2D

#

ins script

forest mica
#

what needs Collider2D?

spark sentinel
#

but yeah stairs shouldnt be triggers..

forest mica
#

yeah i was thinking that

#

okay here's what's happening

#

he goes up the slope when NOT pressed

#

but when I pressed and release he immediately falls through the slope.

#

and won't go back up the slope

#

so we might be getting somewhere

spark sentinel
#

ok now its just a matter of adding some checks to improve it

forest mica
#

yes but why is it going up when I'm not pressing the key but falls through the slope when I press and release up?

raw mural
#

because that's what the code does

forest mica
#

I... wanted to do the opposite LMAO

raw mural
#

then fix it

forest mica
#

Well simply reversing it just gives me the same problem as before

raw mural
#

code does exactly what you tell it to.

#

if you don't understand what you're telling it to do, then why are you surprised

forest mica
#

bro

#

@spark sentinel you said it works for you? what is it doing for you?

raw mural
#

if you can make a step-by-step comment of what something should do, it wouldn't be an issue though. you're only commenting the result you want, and that's why it's so difficult for you

forest mica
#

okay here

spark sentinel
#

instead of disabling collider

#

just switch it to trigger

forest mica
#
  1. When you are not pressing up, you should be able to walk through
  2. When you are pressing up and touching the steps, the player should automatically be moving up the steps
  3. When pressing down, you should go down
spark sentinel
#

and non-trigger

forest mica
#

How do I do that?

delicate radish
#

ah

spark sentinel
#

set the stairs in the beginning to be triggers

delicate radish
#

there is multiple colliders here

spark sentinel
#

no

raw mural
forest mica
#

aight

spark sentinel
#

the issue is it cant find the collider when its disabled

delicate radish
#

no? on for up, one for not go down

#

ok ok

spark sentinel
#

thats another issue

#

that can be fixed raycasting down to check floor is a stairs then dont disable or similiar

delicate radish
#

yes i think focus on going upstair first

#

then goign downstairs

#

but im sure you know this

forest mica
#

yes

spark sentinel
#

@forest mica

#

ignore listcols

#

just look at instead of .enabled do isTrigger

forest mica
#

don't write that line?

spark sentinel
#

nah dont copy any of it just change it to trigger

forest mica
#

got it

delicate radish
#

@spark sentinel this will set to true and stay true

raw mural
forest mica
#

oh

#

so what's happening now is

#

I walk past the steps. but then the thing activates and i can't walk through them anymore

#

like, lemme show a vid

delicate radish
#

what kind of collider does your steps have?

forest mica
#

Box

#

A rotated box

delicate radish
#

can you show a screenshot of your stairs collider

#

maybe it's too steep ?

forest mica
#

he can go up them

delicate radish
#

ok, play and get intot eh situation where you are stuc, and select everythign in scene, it will show all colliders

#

maybe you're stuck on something else

spark sentinel
#

they were inversed

#

since they went from enabled/disable to trigger On/off

forest mica
#

I can move through it but i can't go up when i press up

delicate radish
#

can you show what it looks like in scene view

forest mica
#

oop i knew what it was

#

the last trigger shoulda been false

spark sentinel
#

@forest mica

forest mica
#

so then he's supposed to be able to pass through when he exits the trigger

#

but he doesn't

#

he still climbs down

#

is it because the collider is big?

#

okay here's problem

#

the trigger activates even when i'm not touching the steps

#

and you can't turn it off

spark sentinel
#

btw you have to fix this cs private void OnTriggerExit2D(Collider2D collision) { if (collision.CompareTag("Stairs")) { collision.GetComponent<Collider2D>().isTrigger = true; } } @forest mica

delicate radish
#

i have a really lazy stupid solution to this but i think null will be mad at me

forest mica
#

Does it involve pizza?

delicate radish
#

yes

forest mica
#

I’m game

#

Okay we’re back to it won’t go up when I press up

delicate radish
#

make a static variable that tracks if you are pressing up

forest mica
#

I did that

delicate radish
#

and then in every collider, in update you set enabled = that static variable is true

forest mica
#

I’m an idiot

#

I’m the trigger exit

spark sentinel
forest mica
#

IsUp should be false right?

#

Cause you’re not pressing up anymore

spark sentinel
#

just tested it

#
 bool isUpKeyHeldOrWhatever;
    void Update()
    {
        isUpKeyHeldOrWhatever = Input.GetKey(KeyCode.W);
    }
    private void OnTriggerStay2D(Collider2D collision)
    {
        if (collision.CompareTag("Stairs"))
        {
            if (isUpKeyHeldOrWhatever)
            {
                collision.GetComponent<Collider2D>().isTrigger = false;

            }
            else
            {
                collision.GetComponent<Collider2D>().isTrigger = true;
            }
        }
    }
    private void OnTriggerExit2D(Collider2D collision)
    {
        if (collision.CompareTag("Stairs"))
        {
            if(!collision.GetComponent<Collider2D>().isTrigger)
            collision.GetComponent<Collider2D>().isTrigger = true;
        }
    }``` @forest mica
delicate radish
#

I feel like you are trolling me now

spark sentinel
#

you're not helpful

delicate radish
#

ok give me a sec

#

` if (isUpKeyHeldOrWhatever)
{
collision.GetComponent<Collider2D>().isTrigger = false;

        }
        else
        {
            collision.GetComponent<Collider2D>().isTrigger = true;
        }`

is the same as
collision.GetComponent<Collider2D>().isTrigger = ~isUpKeyHeldOrWhatever ;
is the same as
collision.GetComponent<Collider2D>().isTrigger = ~Input.GetKey(KeyCode.W)

#

you said i was trolling for initially suggesting this and now you sugges tthe same thing!

#

i am trying to help

forest mica
#

And...

#

it doesn't work

#

Fuck my life 🤣

spark sentinel
#

stop saying it doesnt work

#

cause it works

forest mica
#

...because the key was wrong LMAO

#

Okay so...

spark sentinel
#

@forest mica

forest mica
#

It works

raw mural
forest mica
#

So my question now remains

delicate radish
spark sentinel
forest mica
#

if he's on the steps, can I make it so he stays on the steps even when I let go of Up?

raw mural
spark sentinel
#

cause i got them closer to their goal and yall just bickering

#

anyway

#

im off

#

goodluck @forest mica

forest mica
#

oh

#

@spark sentinel can we continue this another time?

#

There's still some stuff I wanna iron out

spark sentinel
#

maybe bigger brain & dingus can help @raw mural @delicate radish

forest mica
#

Like having him stay on the steps even when you release up

delicate radish
#

no hate null you were helpful

forest mica
#

also they're just trying to help too

#

but much appreciate the help!

delicate radish
#

maybe i can help

forest mica
#

let's continue this tomorrow

#

it's getting late here

raw mural
spark sentinel
forest mica
#

ok

#

i'll try that tomorrow

#

thank you

delicate radish
#

i have no idea how you @ you smiley person

raw mural
#

dot

delicate radish
#

@raw mural ok

#

are you workign on a game using tilemaps?

delicate radish
#

is it isometric

forest mica
#

for the floor

#

it's a 2d sidescroller

raw mural
#

it was an old idea that i never got around to since i'm focusing on 3d project for now @delicate radish

delicate radish
#

oh ok

forest mica
#

action platformer

delicate radish
#

ok wait is the question abtou 2d layer or 3d

forest mica
#

2D

raw mural
#

2d tiles + spriteshape

forest mica
#

it's a 2D action platformer

delicate radish
#

so a 2d sidscroller

#

with tilemaps

raw mural
#

so basically assume worst case scenario

forest mica
#

well the floor has tiles?

#

the platforms will presumably have tiles

delicate radish
#

ok i think

#

try multiple tilemaps

forest mica
#

is that how you add textures to platforms or ground?

delicate radish
#

with different sorting layers

#

yeah

forest mica
#

I can do a groundcheck

#

I have ground layer and ground tag

#

I have ladder layer and tag

delicate radish
#

i am working on a top down isometric rpg

forest mica
#

oh

delicate radish
#

one sec let me show

forest mica
#

I'm doing a sidescroller 2d action platformer based on Castlevania

delicate radish
#

so there is 3 layers here

forest mica
#

And God help me I hope this ladder shit is the hardest part

delicate radish
#

there is ground, object(with tree trunks) and foreground for liek treetops

raw mural
#

@delicate radish that looks great for something mspainted @_@

delicate radish
#

hahaha ty

raw mural
#

weird perspective on objects though

delicate radish
#

im not an artist ;-;

forest mica
#

I still gotta figure out how to do enemy behaviors, a basic attack, a special attack that runs on ammo, a secondary special attack that you can swap with the primary special attack, moving platforms

raw mural
#

neither am i, that's why i ended up going with 3d project as priority

forest mica
#

I got six months

delicate radish
#

omg 3d is so much harder than 2d

forest mica
#

think I can do that in six months?

#

i think i can do it

#

with some good tutorials and my previous programming experience to boot

delicate radish
#

are you in a school project

forest mica
#

yeah

#

senior capstone

delicate radish
#

cool

#

unity isn't complicated

raw mural
delicate radish
#

great fog effect

raw mural
#

it's literally gradient to skybox

delicate radish
#

but it's noisy

#

those clouds look nice

#

ok anyway in terms of 2d layering

#

lol

#

there is a depth sorting, usually things higher up are further back so you sort by y

#

sp in you project settings you want this

#

then you can place wall sprite to block things behing them

raw mural
delicate radish
#

you can sopy pasy with depth sorting

#

all depth sorting does is deside what is drawn over what

raw mural
#

let me ms paint that

forest mica
#

thanks guys! i'll continue this tomorrow

#

though i have to go to a church service tomorrow and I also gotta work on art so we'll see

raw mural
#

so let's assume we already have the minor headache

#

and then we add a major

forest mica
#

Is this for my project?

#

Or for his?

raw mural
#

mine, in theory

forest mica
#

Oh ok

raw mural
#

trying to sort through all layers to figure out if everything works as intended would be really annoying unless these layers are limited

#

@forest mica which castlevania had slopes like that btw?

forest mica
#

And you could always walk past them but if you press up while touching them you go up the steps

raw mural
#

yeah i looked at it, looks like they limited layers

#

in that case yeah the solution is simple, just depends on how good you want it to feel

forest mica
#

Ok tomorrow

forest mica
#

Lemme work on Null’s thing a little more too first

forest mica
#

Aight so Null's thing works fine. I modified it and it's working fine.

#

Now I need to figure out how to make it so he moves up the steps when you press up.