Login [Register]
Don't have an account? Register now to chat, post, use our tools, and much more.
Iíve known basic ICE for quite a while, but have only made a few simple programs (GetKey value finder, CubeTimer, something that displays all ICE colors, and one other in the Archives I canít recall to my mind). So now Iíve decided to make something a little more complex (as compared to my old programs Razz). I know Rico already made an awesome version in C, but Iím going to be trying it in ICE.

So far I've finished the grid or whatever itís called (background). Im trying to figure out how to use custom fonts so I can use larger text without too much pixelation. Are there any already made fonts for ICE? I also have to decide whether to use external sprites for the tiles, or just in ICE stuff.

SC link to source. If you want it compiled, just compile it from SC.

I made a GitHub repo here
I've made *some* progress. I made the 2 tile sprite, and I can now move it around the grid, but it can't go more than one space right now. It's also very slow. I know my code is bad, so I need some help optimizing it. Please don't faint at my code Smile.

Source from SC3 (with all those added [|] things):

Code:
[i]ICE2048
Begin
FillScreen(255
20->X
30->Y
Lbl SPRITES
AsmComp(I2048SPR)


Lbl WELCOME


SetTextScale(2,2
PrintStringXY("W[|e]l[|c]om[|e] [t]o ICE2048!",30,100
SetTextScale(1,1
PrintStringXY("E[n]joy yo|ur [s][t][|a]y h[|e]r[|e]...",35,140

PrintStringXY("Press [enter] to continue...",50,210

Pause
FillScreen(255

Lbl TEXT
PrintStringXY("ICE2048 [|b]y j[|c]g[t][|e]r777",9,2

Lbl GRID
SetColor(0
Rectangle(9,19,212,212
SetColor(214
FillRectangle(10,20,210,210
[i]I[n][|d]i|vi[|d]|u[|a]l [|b]lo[|c]k[s] [|b][|e]lo|w
SetColor(182
For(A,20,170,50
For(B,30,180,50
FillRectangle(A,B,41,41
End
End
[i]Bor[|d][|e]r[s] for i[n][|d]i|vi[|d]|u[|a]l [|b]lo[|c]k[s]
SetColor(0
For(C,19,169,50
For(D,29,179,50
Rectangle(C,D,41,41
End
End


Lbl TILES
[i]Sprite(TWO,X,Y



Lbl MOVE
SetColor(182
Repeat getKey=15 or getKey=9
   Sprite(TWO,X,Y
   If getKey=3 and X!=170
      FillRectangle(X,Y,39,39
      X+50->X
   End
   If getKey=2 and X!=20
      FillRectangle(X,Y,39,39
      X-50->X
   End
   If getKey=4 and Y!=30
      FillRectangle(X,Y,39,39
      Y-50->Y
   End
   If getKey=1 and Y!=180
      FillRectangle(X,Y,39,39
      Y+50->Y
   End
End
det(1


The whole thing is on SC3.



EDIT: I used the wonderful suggestion made my PT_ to use for loops, and updated the code here and on SC. See this is why I can't do it by myself Smile.
#2: I made a dumb mistake that screwed it all up, but fixed it/
My next step is to find out how to make the tile(s) move faster, and the keys respond faster.
After I got the tile to move, only one way (right) was moving at an acceptable speed. So, PT advised me to use getKey(X) instead of getKey=X. Now, after pressing [enter] after the welcome screen, it just exits. Any ideas why?


Code:
[i]ICE2048
Begin
FillScreen(255
20->X
30->Y
Lbl SPRITES
AsmComp(I2048SPR)


Lbl WELCOME


SetTextScale(2,2
PrintStringXY("W[|e]l[|c]om[|e] [t]o ICE2048!",30,100
SetTextScale(1,1
PrintStringXY("E[n]joy yo|ur [s][t][|a]y h[|e]r[|e]...",35,140

PrintStringXY("Press [enter] to continue...",50,210

Pause
FillScreen(255

Lbl TEXT
PrintStringXY("ICE2048 [|b]y j[|c]g[t][|e]r777",9,2

Lbl GRID
SetColor(0
Rectangle_NoClip(9,19,212,212
SetColor(214
FillRectangle_NoClip(10,20,210,210
[i]I[n][|d]i|vi[|d]|u[|a]l [|b]lo[|c]k[s] [|b][|e]lo|w
SetColor(182
For(A,20,170,50
For(B,30,180,50
FillRectangle_NoClip(A,B,41,41
End
End
[i]Bor[|d][|e]r[s] for i[n][|d]i|vi[|d]|u[|a]l [|b]lo[|c]k[s]
SetColor(0
For(C,19,169,50
For(D,29,179,50
Rectangle_NoClip(C,D,41,41
End
End


Lbl MOVE
SetColor(182
Repeat getKey(15) or getKey(9)
   Sprite(TWO,X,Y
   If getKey(3) and X!=170
      FillRectangle(X,Y,39,39
      X+50->X
      Sprite(TWO,X,Y
   End
   If getKey(2) and X!=20
      FillRectangle(X,Y,39,39
      X-50->X
      Sprite(TWO,X,Y
   End
   If getKey(1) and Y!=30
      FillRectangle(X,Y,39,39
      Y+50->Y
      Sprite(TWO,X,Y
   End
   If getKey(4) and Y!=180
      FillRectangle(X,Y,39,39
      Y-50->Y
      Sprite(TWO,X,Y
   End
End
det(1
jcgter777 wrote:
After I got the tile to move, only one way (right) was moving at an acceptable speed. So, PT advised me to use getKey(X) instead of getKey=X. Now, after pressing [enter] after the welcome screen, it just exits. Any ideas why?


Code:
[i]ICE2048
Begin
FillScreen(255
20->X
30->Y
Lbl SPRITES
AsmComp(I2048SPR)


Lbl WELCOME


SetTextScale(2,2
PrintStringXY("W[|e]l[|c]om[|e] [t]o ICE2048!",30,100
SetTextScale(1,1
PrintStringXY("E[n]joy yo|ur [s][t][|a]y h[|e]r[|e]...",35,140

PrintStringXY("Press [enter] to continue...",50,210

Pause
FillScreen(255

Lbl TEXT
PrintStringXY("ICE2048 [|b]y j[|c]g[t][|e]r777",9,2

Lbl GRID
SetColor(0
Rectangle_NoClip(9,19,212,212
SetColor(214
FillRectangle_NoClip(10,20,210,210
[i]I[n][|d]i|vi[|d]|u[|a]l [|b]lo[|c]k[s] [|b][|e]lo|w
SetColor(182
For(A,20,170,50
For(B,30,180,50
FillRectangle_NoClip(A,B,41,41
End
End
[i]Bor[|d][|e]r[s] for i[n][|d]i|vi[|d]|u[|a]l [|b]lo[|c]k[s]
SetColor(0
For(C,19,169,50
For(D,29,179,50
Rectangle_NoClip(C,D,41,41
End
End


Lbl MOVE
SetColor(182
Repeat getKey(15) or getKey(9)
   Sprite(TWO,X,Y
   If getKey(3) and X!=170
      FillRectangle(X,Y,39,39
      X+50->X
      Sprite(TWO,X,Y
   End
   If getKey(2) and X!=20
      FillRectangle(X,Y,39,39
      X-50->X
      Sprite(TWO,X,Y
   End
   If getKey(1) and Y!=30
      FillRectangle(X,Y,39,39
      Y+50->Y
      Sprite(TWO,X,Y
   End
   If getKey(4) and Y!=180
      FillRectangle(X,Y,39,39
      Y-50->Y
      Sprite(TWO,X,Y
   End
End
det(1

Try using this routine for getting key values:

Code:

Lbl K
Repeat getKey->K
End
Return

Then just call it from anywhere you need key values.
It is exiting because one of your conditions in the Repeat loop is getKey(9, which is the key code for enter. Because ICE is so fast, when you press enter at the welcome screen you are still pressing it when the game loop runs. Either add a "Pause X" command or just don't use enter at the beginning or in the loop.
  
Register to Join the Conversation
Have your own thoughts to add to this or any other topic? Want to ask a question, offer a suggestion, share your own programs and projects, upload a file to the file archives, get help with calculator and computer programming, or simply chat with like-minded coders and tech and calculator enthusiasts via the site-wide AJAX SAX widget? Registration for a free Cemetech account only takes a minute.

» Go to Registration page
Page 1 of 1
» All times are GMT - 5 Hours
 
You cannot post new topics in this forum
You cannot 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

 

Advertisement