Position changing every second

orYan

  • Posts: 47
Yeah, didn't like the comments so I removed them from the code blocks and reuploaded.

haha alright thats awesome..ill redownload

as so are these actors being created called lightweight actors?  Im a little confused because it says in the stencylpedia they cannot be collided

In this example, no, because I have code for when collisions happen.  Its possible to do for this game, but not being done.  Check out Mee - Snow or Mee - Rain for lightweight example.


ohh wow  :D well its super helpful!!
the example is amazing! I printed it out to look at it more in depth and so i can study it haha...but the issue of it hovering if i quickly move left or right off an existing block still occurs...i have an idea of how i can fix it (another check for collision being true in the "do this after 0.2 seconds" block? ) so ill try it out cause this is actual significant to the gameplay, but if you know what to do already that would be dandy!...
and i notice there are 4 actors, but only the square one spawns, for my game i dont have to randomly spawn the pieces so this isn't really a big issue

Meestar

  • Posts: 654
One actor = Next Piece display (upper right corner)  The other two are unused.  And yes, I haven't fixed the float but your right, trigger a collision detection after the .2 secs.
PM me if you require help.  I'm always glad to help out!

orYan

  • Posts: 47
One actor = Next Piece display (upper right corner)  The other two are unused.  And yes, I haven't fixed the float but your right, trigger a collision detection after the .2 secs.

so i attempted it but was not successful...does the collision attribute go back to false when there is no longer a collision? i added some blocks in thinking that but it didnt work.. have a picture of what i did...i tried to add an "otherwise set collision to false" block too...do i have to create another attribute for like a real time update of a bottom collision being true or false?

Meestar

  • Posts: 654
Go into Boolean - And where you see it say "Do after .2 secs" set lock position to true.  Right under neath the lock position to true put "Trigger event collisioncheck"  Then add...

I'll just do it.
PM me if you require help.  I'm always glad to help out!

Meestar

  • Posts: 654
Tetris has been updated!

Features:
- Blocks cannot be floated!
- New control added: Down arrow will bring your blocks down faster.
PM me if you require help.  I'm always glad to help out!

orYan

  • Posts: 47
Tetris has been updated!

Features:
- Blocks cannot be floated!
- New control added: Down arrow will bring your blocks down faster.


yay! i really appreciate all of this!! :D:D i have to figure out a way to repay you hahaha...but was looking at it and i noticed that when <locked> is true, it always wants to go down? im just assuming this because the down control is just a switch to true if its false...although this faster down movement is eventually something i want to include(how did ya know ahaha), this prevents me from moving left or right if i pressed down
which brings me to the floating block issue...its fixed but its locked as it goes down..so i cannot move it anymore...
I DID TRY and add a <set lockposition to false> in what i think is the right spot (check my picture)..and it did work, for a second, but not quite hahah...a whole bunch of problems come up afterwards like controlling multiple blocks, and floating blocks came back...
i see that there is an event made for the possible floating collision check that happens right before the position locks...
does an event have to be made for the number times in a row i think this might happen in a game level/scene? because my game may require the player to move the piece across a couple pieces over lowering heights...like going down stairs (a collision check would occur at each step)

Meestar

  • Posts: 654
I have it set to keep going down unless it hits the bottom of the play area (screen height - 32) or it detects another actor (which would be that first part of the code there).  To be able to move while going down would require a bit more work, which is why I hadn't put it in yet.  I added in the faster down movement because it works off the new additional collision detection, making me only need one line of code.  I have method to allow movement while falling so I'll get that done in just a moment for you to look at.

I hope you're learning a lot from my code and comments. I feel like I'm making the game for you :p  It is complicated code, mind you.
PM me if you require help.  I'm always glad to help out!

Meestar

  • Posts: 654
Okay, added the new code in.  You can now move left/right after hitting down OR when collision detection occurs.  Also commented the collision detection part.
PM me if you require help.  I'm always glad to help out!

orYan

  • Posts: 47
I have it set to keep going down unless it hits the bottom of the play area (screen height - 32) or it detects another actor (which would be that first part of the code there).  To be able to move while going down would require a bit more work, which is why I hadn't put it in yet.  I added in the faster down movement because it works off the new additional collision detection, making me only need one line of code.  I have method to allow movement while falling so I'll get that done in just a moment for you to look at.

I hope you're learning a lot from my code and comments. I feel like I'm making the game for you :p  It is complicated code, mind you.


haha yes you are! :S this will stop once i get this movement down...the rest i am a little more confident in figuring out...your example is really teaching me a lot although im still trying to wrap my head around how the left and right movements work because like you said it is complicated

orYan

  • Posts: 47
Okay, added the new code in.  You can now move left/right after hitting down OR when collision detection occurs.  Also commented the collision detection part.

oh snap you're so fast :O

Meestar

  • Posts: 654
Okay, added the new code in.  You can now move left/right after hitting down OR when collision detection occurs.  Also commented the collision detection part.

oh snap you're so fast :O

It was only 2 seconds of work.  Would have done it earlier but I really had to get class work done.  How's it look?
PM me if you require help.  I'm always glad to help out!

orYan

  • Posts: 47
Okay, added the new code in.  You can now move left/right after hitting down OR when collision detection occurs.  Also commented the collision detection part.

oh snap you're so fast :O

It was only 2 seconds of work.  Would have done it earlier but I really had to get class work done.  How's it look?


ahah really??!! man i want solve things that fast haha...and it works BEAUTIFUL hahha just testing every kind of situation with "block buildings" i can think of and its sliding off the tops perfectly and falling...this is nothing but amazing hahah im so excited thank you!

oh and about the down button code...you mentioned it being the way it is just because it was only one line of code...so instead of it triggering the event collision..i can make another code block to make it go down instead of using the existing collision code? i can think of that myself if its possible hahah its just that i would like to be able to go down fast and then move left or right after a collision (im not sure what happens but if i go down fast a new piece spawns as soon as a bottom collision occurs, leaving me unable to move left or right)

orYan

  • Posts: 47
also ive made a post about this but my stencyl program is messed up or something...i cannot see any changes to a code unless i restart the whole program...even if i save before i test game...so its really hard for me to experiment and find out how to do things through trial and error (which is how i usually like to learn these kinds of things) when i have to restart everytime, im pretty sure anyone else would have given up by now but youve helped a lot...i plan to install stencyl on another computer soon so hopefully it just something with my old laptop and installing windows 8 :S

Meestar

  • Posts: 654
Someone else may have given up by now, but not me.  I'm dedicated to helping others learn.  Just look at all the code I wrote for you!  If this helps you learn how to better program, then I'm glad to have helped. Also, you can substitute the down code however you like.

« Last Edit: February 06, 2013, 11:26:54 pm by Meestar »
PM me if you require help.  I'm always glad to help out!