Castle Paradox Forum Index Castle Paradox

 
 FAQFAQ   SearchSearch   MemberlistMemberlist   UsergroupsUsergroups   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 
 Gamelist   Review List   Song List   All Journals   Site Stats   Search Gamelist   IRC Chat Room

OHR Tetris

 
Post new topic   Reply to topic    Castle Paradox Forum Index -> HELP!
View previous topic :: View next topic  
Author Message
SunsOfFlame




Joined: 28 Apr 2003
Posts: 139

PostPosted: Mon May 24, 2004 6:20 pm    Post subject: OHR Tetris Reply with quote

Alright, I'm trying to make a Tetris clone, and the only thing I can't get is how to keep the blocks as one. I have creation and moving down, but I need to handle stopping before I can work on really anything else.

I'm trying to explain this though its difficult.

I need a block to stop when one part of it hits a stopping point
Then it will turn into another sort of block(which acts now as a stopping point for future blocks)
But the block itself must keep shape, and not break into seperate peices.

I'm using NPC 0 as the block, and probably NPC 1 as stopping points.

Any help?

EDIT-I thought I had one, it would check if the NPC was still moving (NPCs stp when they hit each other right?) But it stops the block as soon as the script reaches it.

Moving script(works):
Code:
script,moveblock,begin
 variable(loop,square count,current square)
 set variable(square count,NPC copy count(0))
 while (usable==1) do (
  for(loop,0,square count) do (
   set variable(current square,NPC reference(0,loop))
   walk NPC (current square, south, one)
  )
 checkforland
 )
end

Landing script(that doesnt work)
Code:
script, checkforland,begin
 variable(loop,square count,current square)
 set variable(square count,NPC copy count(0))
 for(loop,0,square count) do (
  set variable(current square,NPC reference(0,loop))
  if ((NPC is walking (current square))==false) then (
   set variable (usable,0)
  )
  wait for all
 )
end
Back to top
View user's profile Send private message Visit poster's website AIM Address
junahu
Custom Title: 45 character limit




Joined: 13 Jan 2004
Posts: 369
Location: Hull, England

PostPosted: Tue May 25, 2004 4:38 am    Post subject: Reply with quote

In Tetris, there's only ever one block moving at a time. Therefor, when one block lands and turns into npc 1 it must then also turn all the blocks in the shape to npc 1


[c][d]
[b]
[a]

if [a] lands, it must turn [d] into npc 1 to stop it falling.
if [d] lands, it must turn [a] into npc 1 to stop a, b and c from falling

[d]
[c][b][a]

if [a] lands, it must turn [b] and [c] into npc 1 to stop b,c and d falling.
if [b] lands, it must turn [a] and [c] into npc 1 to stop a, c and d from falling
if [c] lands, it must turn [b] and [a] into npc 1 to stop a and b falling

of course, repeating this for every rotation of all 7 shapes would be stupid.

[1][2][3][4][5][6][7][8][9]
[a]
[b]
[c]
[d]
[e] 5e
[f]
[g]
[h]
[i]

alternatively you could just turn every npc in a four block radius around the npc into npc1.

also, a word of advice. In your scripts you should refer to the npcs in order from the bottom of the screen to the top (for when you clear a line and the whole structure has to turn back to npc 0 and move down).

of course, you shouldn't listen to my advice at all. It sucks Big grin
_________________
Back to top
View user's profile Send private message Send e-mail
Guest







PostPosted: Tue May 25, 2004 4:40 am    Post subject: Reply with quote

my last diagram didn't come out right. e5 should be in the very centre of the grid
Back to top
Ysoft_Entertainment
VB Programmer




Joined: 23 Sep 2003
Posts: 810
Location: Wherever There is a good game.

PostPosted: Tue May 25, 2004 5:58 am    Post subject: Reply with quote

wait for all is bad idea, don't use it

did you make usable a global variable? if so, than the script should work, if not, make it than.
_________________
Try my OHR exporter/importer.
OHRGFX
Striving to become better pixel artist then Fenrir Lunaris. Unfortunately the laziness gets in the way of my goals.
Back to top
View user's profile Send private message Send e-mail Visit poster's website
junahu
Custom Title: 45 character limit




Joined: 13 Jan 2004
Posts: 369
Location: Hull, England

PostPosted: Wed May 26, 2004 2:13 am    Post subject: Reply with quote

usable has to be a global variable. Local variables have to be defined within the script that they are used and there is no variable(useable) in that script.

besides, I think his problem is keeping all the blocks in the shape as one

e.g.
an L block landing on a square block as below

[a1][a2][a3]......
............[a4]......
............[b1][b2]
............[b3][b4]

[a4] stops moving and becomes npc 1. [a3] stops too because it is immediately above [a4]. [a1] and [a2] keep falling however, because they haven't been told to stop moving

............[a3]......
............[a4]......
............[b1][b2]
[a1][a2][b3][b4]

and they end up here. This would make tetris almost impossible to lose because blocks would keep falling until they fill a gap.

Is ths your problem? (sorry I didn't explain it quite so well earlier)
_________________
Back to top
View user's profile Send private message Send e-mail
TMC
On the Verge of Insanity




Joined: 05 Apr 2003
Posts: 3240
Location: Matakana

PostPosted: Wed May 26, 2004 3:01 am    Post subject: Reply with quote

Yes, can you please explain exactly how it does not work?

Also, you should be writing
Code:

for(loop,0,square count -- 1)


instead of
Code:
for(loop,0,square count)

_________________
"It is so great it is insanely great."
Back to top
View user's profile Send private message Send e-mail
junahu
Custom Title: 45 character limit




Joined: 13 Jan 2004
Posts: 369
Location: Hull, England

PostPosted: Wed May 26, 2004 4:06 am    Post subject: Reply with quote

"But the block itself must keep shape, and not break into seperate peices"

This is his problem (I'm sure of it even though I generate no response every time I post about it Sad... )


_________________
Back to top
View user's profile Send private message Send e-mail
ShakeyAir Not Logged in
Guest






PostPosted: Wed May 26, 2004 2:01 pm    Post subject: Reply with quote

Yea, usable is global.

The Checkforland should turn it off if the block hit a landed block, and when its off, the Move script shouldn'tdo anything....

I can't mess with it now (grounded from the computer, got written up a few times today at school....parents are downstairs)I should have included that when I run the game, the block goes down 1 and stops. I don't know why.....

Wait...while writing this...I think I figured it out. TOo bad I still can't mess with it.

I put the script linking for Checkforland outside of the loop. Its gotta be inside to work...That still, however, doesn't explain why the blcok stopped...I got some bugfixing to do when I'm ungrounded in awhile haha...

...wait...i think it has something to do with the WaitForAll too...
I dunno lol.

Sorry I didnt log in. In a hurry. Peace.
Back to top
Display posts from previous:   
Post new topic   Reply to topic    Castle Paradox Forum Index -> HELP! All times are GMT - 8 Hours
Page 1 of 1

 
Jump to:  
You can post new topics in this forum
You can reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


Powered by phpBB © 2001, 2005 phpBB Group