#Summary in first post
1 messages · Page 1 of 1 (latest)
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?
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
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?
Yes I am, I just don't have anything to suggest right now
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
yeah the thread won't be lost now, don't worry about it
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
So this should make it so you can go past the steps if not pressing up right?
@raw mural @vast parrot
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
That's the point?
and most important question is how's your environment made
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
that's because you have 0 understanding of what you've done
Hey Spr2 told me to do this
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
what he told you to do
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
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
just make a new gameobject in player
this code will assign the first collider to both variables i hope you know
now its child
forget the code
forget all that
ok ok ok
you never wanna hard reference colliders like that
summary is at top, and yes he's clearly a beginner trying to do something advanced so expect a lot of headache
this isn't hard
itsok
colliders and stuff are hard and annoying and i am 8 years unity experience
if player has rigidbody it should work fine for child as well
thats 2D anyway
ok
it makes a composite
So I'll make a script for the child
yes child has trigger collider + script
Summary in first post
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..
well it can go up slopes
so yes
ok thats fine
worry about this system first
yes
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
you can dynamically set the collider size easily if you use a circle collider 2D
mayeb this helps
this will just confusing things
ok sorry
they're new
private bool isUp
you're essentially destroying stairs if you're not holding up though
this good?
and touching the stair collider is bad in general, in case there are enemies on it
so what i understand, you want a collider to act as a ramp to make you go upstairs if you are pressing up?
yes
thread will stay for a week of inactivity so take your time to think about the solution
so, you shoudl want collider enabled if isUp is true right?
@delicate radish and down*
did you look at my image @forest mica
yes
and ideally they should be on same physics layer
small thing, you dont need to do
if (isUp == true)
you can just do
if (isUp)
what did u do
show the full scene and inspector
with new code
it works on my end
nothing good, he disables random collider if holding up above stairs
random collider?
getcomponent
how's it a "random" collider
so you did nothing Like i said huh..
A
yeah he tends to do that
trying Input.GetKey instead of Input.GetKeyUp
what?
GetKeyUp only works ont eh frame it is pressed
its actually when its released
sorry, right
anything not referenced is random to me, since he may add another collider or move the script to another object and the issue will be hard to find
doesn't do anything
no idea what ur talking about the reference is checked there on collision..
So Null what am I missing?
what he did in the first script is completely wrong and hard coded... it would never work
and you want collilder to be enabled if key is down right? right now you are setting it to disabled if key is down
literally nothing here would work though
what are u talking about lol I just tested what I sent him and it works
oh wait i see what you did there
yes why wouldn't i
@forest mica in Update() try this:
GetComponent<Collider2D>().enabled = Input.GetKey(KeyCode.Up);
the radius is also bigger
yeah that's essentially what SPR2 did but backwards, disabling stairs instead of player component
erase the rest of the code
bro no
please dont
ok i wont
now u r just trolling
its a good test
its bad code i know but it will test if its a code problem or a component config problem
alright move on cause trolling isn't helpful and can get u muted
he's supposed to move through the steps if he's not alright climbing it
you need to make the trigger around player a few sizes bigger then the player
@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
that's probably irrelevant for grinch though
biggger because it has to be ahead of the player when hes walking
ehh guess Ill show you , let me get to my workstation
crank it up to double~triple size of player
right
aight then what?
put the script on the trigger, and fix it to True
it already is?
ok
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..
yeah dw no enemies are going up or down steps
and projectiles will pass through them
how did u manage to even fuckup copy and paste
look carefully at ontrigger enter is true
doesnt work ?
nope
did tag correctly the ladder
check console for error
screenshot inspector ladder collision
that should not be trigger but Uh.. mybad
it needs Collider2D
ins script
what needs Collider2D?
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
ok now its just a matter of adding some checks to improve it
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?
because that's what the code does
I... wanted to do the opposite LMAO
then fix it
Well simply reversing it just gives me the same problem as before
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
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
okay here
I got it
instead of disabling collider
just switch it to trigger
- When you are not pressing up, you should be able to walk through
- When you are pressing up and touching the steps, the player should automatically be moving up the steps
- When pressing down, you should go down
and non-trigger
How do I do that?
ah
set the stairs in the beginning to be triggers
there is multiple colliders here
no
congratulations, we've now reached the point from 1 hour ago
aight
the issue is it cant find the collider when its disabled
thats another issue
that can be fixed raycasting down to check floor is a stairs then dont disable or similiar
yes i think focus on going upstair first
then goign downstairs
but im sure you know this
yes
don't write that line?
nah dont copy any of it just change it to trigger
got it
@spark sentinel this will set to true and stay true
see, you're missing the point. if you turn it into code here's the result of that:
if(!pressingUp){ result1_WalkThrough(); }
else if(touchingSteps) { result2_MoveUp(); }
if(pressingDown) { result3_GoDown(); }
so all you just said is condition and result, not step-by-step instructions
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
Mind the Christmas music
what kind of collider does your steps have?
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
sorry here
they were inversed
since they went from enabled/disable to trigger On/off
I can move through it but i can't go up when i press up
can you show what it looks like in scene view
@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
btw you have to fix this cs private void OnTriggerExit2D(Collider2D collision) { if (collision.CompareTag("Stairs")) { collision.GetComponent<Collider2D>().isTrigger = true; } } @forest mica
i have a really lazy stupid solution to this but i think null will be mad at me
Does it involve pizza?
yes
make a static variable that tracks if you are pressing up
I did that
and then in every collider, in update you set enabled = that static variable is true
just stop talking
this will work 100%
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
I feel like you are trolling me now
can you just quit spamming nonsense
you're not helpful
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
It works
yeah but the fundamental issues are still here, let's just stay silent until they realize it the hard way. it's kinda important for learning process too so eh
So my question now remains
im trying to help i just dont liek being told to shut up
if you're so Enlighted why don't u say something useful instead
if he's on the steps, can I make it so he stays on the steps even when I let go of Up?
you can look at the stuff at the start and try to help me instead, null's solution would break multiple times with those rules
cause i got them closer to their goal and yall just bickering
anyway
im off
goodluck @forest mica
oh
@spark sentinel can we continue this another time?
There's still some stuff I wanna iron out
maybe bigger brain & dingus can help @raw mural @delicate radish
Like having him stay on the steps even when you release up
no hate null you were helpful
maybe i can help
@delicate radish can't pin in threads for some reason
just raycast down from player feet and if there is stairs tag underneath then don't make it trigger
i have no idea how you @ you smiley person
dot
yes
is it isometric
it was an old idea that i never got around to since i'm focusing on 3d project for now @delicate radish
oh ok
action platformer
ok wait is the question abtou 2d layer or 3d
2D
2d tiles + spriteshape
it's a 2D action platformer
so basically assume worst case scenario
is that how you add textures to platforms or ground?
I can do a groundcheck
I have ground layer and ground tag
I have ladder layer and tag
i am working on a top down isometric rpg
oh
one sec let me show
I'm doing a sidescroller 2d action platformer based on Castlevania
And God help me I hope this ladder shit is the hardest part
there is ground, object(with tree trunks) and foreground for liek treetops
@delicate radish that looks great for something mspainted @_@
hahaha ty
weird perspective on objects though
im not an artist ;-;
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
neither am i, that's why i ended up going with 3d project as priority
I got six months
omg 3d is so much harder than 2d
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
are you in a school project
yeah but with good shaders even test scenes look nice
very nice
great fog effect
it's literally gradient to skybox
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
in my case i'd want to avoid depth sorting so that i could copypaste preset level chunks
you can sopy pasy with depth sorting
all depth sorting does is deside what is drawn over what
let me ms paint that
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
mine, in theory
Oh ok
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?
Ever since the first Castlevania you had steps that if you go up then they take you to different paths
And you could always walk past them but if you press up while touching them you go up the steps
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
Ok tomorrow
Okay so you said you had a simple solution?
Lemme work on Null’s thing a little more too first