Position changing every second

orYan

  • Posts: 47
When <collision> becomes <true>:
  Do after <x> seconds
    Set lock position to <true>

ALWAYS:
  if <NOT lock position>
    if <left/right was pressed>
      set <x> to <(X of Self)-/+16> (-16 for left, +16 for right)

When <Self> collides with something else:
  if bottom of actor is hit
    set collision to true

Do Every <1> seconds:
  If <NOT lock position>
    set <y> to <(Y of Self)+16> for <Self>
  otherwise
    cancel

All this goes into actor behavior and should be attached to the block actors.

WOW this is so amazing of you to show me...thank you so much :D:D:D

one question tho...is the "set lock position" a code block in behaviors? or it it just setting the x/y to 0

Meestar

  • Posts: 654
Its just a boolean.  And your welcome!  Always glad to help out!
PM me if you require help.  I'm always glad to help out!

orYan

  • Posts: 47
Its just a boolean.  And your welcome!  Always glad to help out!

what is is the default boolean value i should set it too, no?

alright so i tried it out but it still goes through the other actor...i have some pictures below of the code...the first picture i wanted to ask if those had to be checked...what is that for?

the rest of the pictures are the code blocks (im not sure i laid it out right with the three events on the left), my scene (just get an idea of what im doing) an the collision groups (each color has its own group and the parent which is the falling piece(the one witht he x's) is in the players)...all the collision groups have the same things greened

« Last Edit: January 29, 2013, 07:59:12 pm by orYan »

Meestar

  • Posts: 654
The problem I see there is in the always code.

If Collision = true
 set lockposition to true.

Under the behaviors menu (Where you found "Always" and "Created") called "Boolean".  You should use that for that instead.  Besides that, nothing.  I haven't tested this code, but theoretically it should work.  Let me try this.

« Last Edit: January 29, 2013, 08:57:13 pm by Meestar »
PM me if you require help.  I'm always glad to help out!

orYan

  • Posts: 47
The problem I see there is in the always code.

If Collision = true
 set lockposition to true.

Under the behaviors menu (Where you found "Always" and "Created") called "Boolean".  You should use that for that instead.  Besides that, maybe put "This Actor" where it says "actor1".  I haven't tested this code, but theoretically it should work.  Let me go do that.

oh i was just about to write another update..i found the boolean under the events menu and also a do every event...check out the pictures for the new code...it still doesnt work though...

and i cant drag this actor to the actor1 spot....i can only choose actor 1 or actor 2

Meestar

  • Posts: 654
The problem I see there is in the always code.

If Collision = true
 set lockposition to true.

Under the behaviors menu (Where you found "Always" and "Created") called "Boolean".  You should use that for that instead.  Besides that, maybe put "This Actor" where it says "actor1".  I haven't tested this code, but theoretically it should work.  Let me go do that.

oh i was just about to write another update..i found the boolean under the events menu and also a do every event...check out the pictures for the new code...it still doesnt work though...

and i cant drag this actor to the actor1 spot....i can only choose actor 1 or actor 2

I just tested it, it works fine.  Do you have tiles along the bottom of your screen?  It doesn't count the bottom of the screen as a collision. Also, for the boolean, you forgot your "Do after x seconds" for that additional movement before stopping.  Also, if the left/right movement is too fast for you, use:

(Under input)When <control> is pressed:
  if not lockposition
    move left/right

If you still can't get it, I'll upload to forge for you.  BTW, Love that you decided to start learning by Tetris.  One of the best games to start learning with.
PM me if you require help.  I'm always glad to help out!

orYan

  • Posts: 47
The problem I see there is in the always code.

If Collision = true
 set lockposition to true.

Under the behaviors menu (Where you found "Always" and "Created") called "Boolean".  You should use that for that instead.  Besides that, maybe put "This Actor" where it says "actor1".  I haven't tested this code, but theoretically it should work.  Let me go do that.

oh i was just about to write another update..i found the boolean under the events menu and also a do every event...check out the pictures for the new code...it still doesnt work though...

and i cant drag this actor to the actor1 spot....i can only choose actor 1 or actor 2

I just tested it, it works fine.  Do you have tiles along the bottom of your screen?  It doesn't count the bottom of the screen as a collision. Also, for the boolean, you forgot your "Do after x seconds" for that additional movement before stopping.  Also, if the left/right movement is too fast for you, use:

(Under input)When <control> is pressed:
  if not lockposition
    move left/right

If you still can't get it, I'll upload to forge for you.  BTW, Love that you decided to start learning by Tetris.  One of the best games to start learning with.

:S i still cant get it to work...what does the <not <Attribute>> green block mean exactly...and the forge would be awesome lol..im "landing" my falling piece on other block actors...if i let it fall to the bottom of the scene it disappears when 2 blocks are left as it goes down

i have an idea for a game and it has these game mechanics..i hope once i get a good feel of how this all works i can stop asking so many questions...are their any tutorials with the version of stencyl that i have?

« Last Edit: January 29, 2013, 09:56:08 pm by orYan »

Meestar

  • Posts: 654
The <Not <<Attribute>>> is kind of hard to describe.  Here are some examples:
If <Not <Lockposition>> is the same as If <Lockposition> = false
If <number> <not => 25
Is: If number is a number other than 25.

If <Not><Number> <Not => 25
 Same as if <Number> = 25.

The Stencylpedia is really the best place to learn how to use Stencyl.  The articles sometimes have out-dated pictures, but the code still works.

The demo I made is on the forge.  Go to games and search for Tetris.
PM me if you require help.  I'm always glad to help out!

orYan

  • Posts: 47
The <Not <<Attribute>>> is kind of hard to describe.  Here are some examples:
If <Not <Lockposition>> is the same as If <Lockposition> = false
If <number> <not => 25
Is: If number is a number other than 25.

If <Not><Number> <Not => 25
 Same as if <Number> = 25.

The Stencylpedia is really the best place to learn how to use Stencyl.  The articles sometimes have out-dated pictures, but the code still works.

The demo I made is on the forge.  Go to games and search for Tetris.

oh okay so its like a double negative kind of thing?  is it better for performance than the alternatives in your explanation? and OMG thank you SO much for that game kit....haha it even says its for me...thanks a lot :D:D:D:D...i didnt get to try out the game kit as soon as i downloaded it...so i just tested it and the collision occured but it moved the other actor and it didnt stop...im going to look at the actual code when i get home from work so ill be able to see if i can figure it out


again THANK YOU! hopefully i finish this soon :D

Meestar

  • Posts: 654
You're welcome!  Glad I could help.  Actually, to stop it from colliding with the other blocks and pushing them you need to have the block check for another block beneath it.  I have a much better version done up, but its a lot more complex than this version.  Don't want to confuse you.  Also, Not doesn't really speed up anything, just a lot easier to read or, if you dont want to check to see if something is true.
PM me if you require help.  I'm always glad to help out!

orYan

  • Posts: 47
You're welcome!  Glad I could help.  Actually, to stop it from colliding with the other blocks and pushing them you need to have the block check for another block beneath it.  I have a much better version done up, but its a lot more complex than this version.  Don't want to confuse you.  Also, Not doesn't really speed up anything, just a lot easier to read or, if you dont want to check to see if something is true.

oh okay when i opened it up in stencyl it didnt move them..but if i move left or right i can...so i check for a collision on the when they are landed and then what...how can i "lock" the position..just set x and y to self?

Meestar

  • Posts: 654
No, check my behavior under the Boolean code block.  When it sets collide to true it waits about .2 seconds then turns on lock position which stops left/right movement in the always code.  When collide becomes true it cacels the timer causing the blocks to fall, which stops downward movement.

I have the new one uploaded.
PM me if you require help.  I'm always glad to help out!

orYan

  • Posts: 47
No, check my behavior under the Boolean code block.  When it sets collide to true it waits about .2 seconds then turns on lock position which stops left/right movement in the always code.  When collide becomes true it cacels the timer causing the blocks to fall, which stops downward movement.

I have the new one uploaded.

i tried adding to the updated events a if lock position is true set x and y to self..but it didnt work..but ill check out your new upload :D thank you!

Meestar

  • Posts: 654
No, check my behavior under the Boolean code block.  When it sets collide to true it waits about .2 seconds then turns on lock position which stops left/right movement in the always code.  When collide becomes true it cacels the timer causing the blocks to fall, which stops downward movement.

I have the new one uploaded.

i tried adding to the updated events a if lock position is true set x and y to self..but it didnt work..but ill check out your new upload :D thank you!

Just keep in mind the new one is a bit complicated.
PM me if you require help.  I'm always glad to help out!

orYan

  • Posts: 47
No, check my behavior under the Boolean code block.  When it sets collide to true it waits about .2 seconds then turns on lock position which stops left/right movement in the always code.  When collide becomes true it cacels the timer causing the blocks to fall, which stops downward movement.

I have the new one uploaded.

i tried adding to the updated events a if lock position is true set x and y to self..but it didnt work..but ill check out your new upload :D thank you!

Just keep in mind the new one is a bit complicated.

oh i love this you even put comments and stuff..this is really helpful!...but lol when i move the blocks left or right when they are right beside a block, it still moves the others ones slightly...is my stencyl version bugged?