YesNoOk
avatar

Make it stuck at the Right edge. (Read 1690 times)

Started by nissouma55, November 12, 2017, 02:54:31 pm
Share this topic:
Make it stuck at the Right edge.
New #1  November 12, 2017, 02:54:31 pm
  • *
So what im trying to do, is make a Shuriken that will go horizontally and will stop at the wall, getting stuck at it before disapearing, kinda like what a real shuriken would do. And I want it to be bind to the screen and actually stay stuck at the wall till it disapears.

So I started by making two states, one for the shuriken (Helper), and one for when it gets stuck.

I tried to make the shuriken change states when it hits the wall. So I did something like this :

[State 0, ChangeState]
type = ChangeState
trigger1 = pos x + camerapos x > rightedge
trigger2 = pos x + camerapos x < leftedge
value =2002

Problem here is it doesnt always trigger... and sometimes it triggers too far from wall.

So in the state where it is supposed to stuck at the wall I did this :
[State 0, PosSet]
type = PosSet
trigger1 = time = 0
x = camerapos x + screenwidth/2

I tryed to posset it at the rightedge.

Thing is, nothing of all this is working... And im completely stuck.
Help ?

Would also be nice to know why my method is not working and where I messed the whole thing up...
Last Edit: November 12, 2017, 04:43:31 pm by nissouma55
Re: Make it stuck at the Right edge.
#2  November 12, 2017, 03:58:50 pm
  • ****
    • Brazil
    • chng.it/QbGdS8rbnh
Maybe it will work with a (back/front)edgedist parammeter, sorta like this:

trigger1 = frontedgedist < 5
trigger2 = backedgedist < 5
Re: Make it stuck at the Right edge.
#3  November 12, 2017, 04:25:03 pm
  • *
Thank you for your help.
I somehow fixed it and made it bind to the right edge screen simply by making posset into this :
[State 0, PosSet]
type = PosSet
trigger1 = 1
x = gamewidth/2

But I still dont understand why the gamewidth/2 returns the edge of the screen and I figured out that changestate wasnt working bcz at one point I didnt save anim and lost it...

But could anyone explain me what exactly is gamewidth ? lol