How to create wall?
chosenonestudios
Member Posts: 1,714
I know you can create "walls" by using the collide attribute, but its not working for me....
Basically its set up so:
when touch is pressed: constrain mouse x to self position x and same for y values.... That works great, but theres no colliding going on.... My wall is set to not move (as walls shouldn't) My actor just goes right through it...
This might seem really simple to some of you, and I might feel stupid after I know how to do it, but I cant for the life of me figure it out haha!
Anyway, Thanks in Advance!
Basically its set up so:
when touch is pressed: constrain mouse x to self position x and same for y values.... That works great, but theres no colliding going on.... My wall is set to not move (as walls shouldn't) My actor just goes right through it...
This might seem really simple to some of you, and I might feel stupid after I know how to do it, but I cant for the life of me figure it out haha!
Anyway, Thanks in Advance!
Comments
Then set the collide to actor o type wall.
@iDeveloperz...... yeah used that and it didn't work (see previous post)
Anyway It should work. Is the resperority (I can't spell) set to 0?
Also make sure the collide is not put in a rule, common mistake I do.
And finally If you have changed the actors prototype then whatever you add in the original actor will not appear in the actor you have edited.
They are just common mistakes I do. Maybe some other people here do it but work it out instantly.
No I didn't haha jk fixed now my b
Anyway It should work. Is the resperority (I can't spell) set to 0?
yeah the restitution is 0
Also make sure the collide is not put in a rule, common mistake I do.
not in rule
And finally If you have changed the actors prototype then whatever you add in the original actor will not appear in the actor you have edited.
no prototypes
They are just common mistakes I do. Maybe some other people here do it but work it out instantly.
I think it has something to do with the constrain of the actor, Im not sure though because I've got this to work with other things, just not constraining....
So I have my main actor and an invisible wall. In the invisible wall I put the behavior "collide" and (Bounce when colliding with actor of type) and then I put the other actor that I wanted it to collide with. I then set the restitution of both actors to 0 and made the invisible wall unmovable and everything worked fine.
Hope this helped!
If you don't want to I understand.
what you can do tho constrain a limit to an actor. (do this only if you need few actors to be blocked by a wall)
what i mean is:
Then make a rule saying when attribute self.positionX </> 32
constrain attribute self position to 32
that blocks an actor from moving further.
im not sure weather this helps because it doesnt affect multiple actors. this is just incase you only have 1-3 actors which need it (MAXIMUM)
good luck
@iDeveloperz Its cool, if I still can't get it to work I'll upload it
@giacomopoppi thats unfortunate I think its probably a problem with GS though
Thanks for the tip! I didn't think to do that One little problem though, after it stops it you can release it and then you can pick it back up and drag it over, when you set it down it'll go back, but you can still go by....
Thanks guys for all your help!
Edit: Also, it gets stuck on the wall and you have to let go move it again...
Ugh is seems GS isn't meant to do this
Constraining an Actor will override all collisions.
So you can't use other Actors to set limits, like giacomopoppi said, you will need to add Rules to your Constrain.
Your Rule set will need to be set up something like this:
Rule
When all conditions are valid
Touch is pressed
-----Rule
-----When all conditions are valid
-----selfPosition.X < [left limit]
----------Constrain self.Position.X to [left limit]
-----otherwise
----------Rule
----------When all conditions are valid
----------selfPosition.X > [right limit]
---------------Constrain self.Position.X to [right limit]
----------otherwise
---------------Constrain self.Position.X to Touch.X
-----Rule
-----When all conditions are valid
-----selfPosition.Y < [bottom limit]
----------Constrain self.Position.Y to [bottom limit]
-----otherwise
----------Rule
----------When all conditions are valid
----------selfPosition.Y > [top limit]
---------------Constrain self.Position.Y to [top limit]
----------otherwise
---------------Constrain self.Position.Y to Touch.Y
I didn't test that, it's just off the top of my head, but something like that SHOULD work..
I tried what you did, but it didn't work... Well it did, but not exactly what I want it to do haha
Heres what happened.. When it hits one of those limits it travels back and forth between the limit and the mouse position really fast...
Any suggestions?
Thanks in advance
It sets limits without using collision.
Dig through it and see if you can use it.
@artonskyblue when you open GS, you see new project, recent projects, shared projects etc. click on shared projects, search for what you want then click on the pencil and kabam you got it:)
@artonskyblue np:)