Help?
Author |
Message |
Dazzle
![](http://compsci.ca/v3/uploads/user_avatars/4341944135105a5a661b36.jpg)
|
Posted: Tue Jan 22, 2013 7:51 pm Post subject: Help? |
|
|
Hello im not too sure if this forum is still alive or not but i am having some difficulties with turing .. i have made my own custom tiles for turing so i can make a 2D-RPG and its tiles based .. but i keep getting this error
The Color Value 7001 Is Out Of Bounds. Max Color Value : 256 |
|
|
|
|
![](images/spacer.gif) |
Sponsor Sponsor
![Sponsor Sponsor](templates/subSilver/images/ranks/stars_rank5.gif)
|
|
![](images/spacer.gif) |
Tony
![](http://wiki.compsci.ca/images/f/f4/OniTony.gif)
|
|
|
|
![](images/spacer.gif) |
Dazzle
![](http://compsci.ca/v3/uploads/user_avatars/4341944135105a5a661b36.jpg)
|
Posted: Tue Jan 22, 2013 8:03 pm Post subject: RE:Help? |
|
|
I just need a solution or something is there a way to change it or is there a program to use so i can make stuff in 256 color value??
PS. a newbie with turing |
|
|
|
|
![](images/spacer.gif) |
Zren
![](http://compsci.ca/v3/uploads/user_avatars/1110053965512db6185954b.png)
|
Posted: Tue Jan 22, 2013 8:06 pm Post subject: RE:Help? |
|
|
Turing only supports a maximum of 1024 colour ids. Note how maxcolor maxes out at 1023 in the following code. Read more here: RGB.AddColor
Turing: |
for r : 0 .. 256
for g : 0 .. 256
for b : 0 .. 256
var newColorId := RGB.AddColor (r / 256, g / 256, b / 256)
put newColorId, " ", maxcolor
end for
end for
end for
|
|
|
|
|
|
![](images/spacer.gif) |
Dazzle
![](http://compsci.ca/v3/uploads/user_avatars/4341944135105a5a661b36.jpg)
|
Posted: Tue Jan 22, 2013 8:09 pm Post subject: RE:Help? |
|
|
But than how would you add detail to your tiles?? is there a program to do separate MAPPING? the only programs ive seen i dont understand how to intagrate with turing |
|
|
|
|
![](images/spacer.gif) |
Zren
![](http://compsci.ca/v3/uploads/user_avatars/1110053965512db6185954b.png)
|
Posted: Tue Jan 22, 2013 8:34 pm Post subject: RE:Help? |
|
|
You can only have 1024 colour ids at one time. You can draw with colorId=1, then set it to another color value, and draw with it again. Once it's drawn to the screen, you don't need to keep it anymore.
This can be proven with:
Turing: |
var colorId := 0
RGB.SetColor (colorId, 1, 1, 1)
Draw.FillBox (0, 0, maxx div 2, maxy, colorId )
RGB.SetColor (colorId, 0, 0, 0)
Draw.FillBox (maxx div 2, 0, maxx, maxy, colorId )
|
If the left half of the screen (the first draw operation) really depended on colorId=0, it would have changed when we changed it to another colour.
You can use Pic.Draw() if you want to draw tiles anyways (it's not limited to the colours you've set).
Turing has really weird limitations.
MAPPING? Are you referring to a program that will edit tile based maps? |
|
|
|
|
![](images/spacer.gif) |
Dazzle
![](http://compsci.ca/v3/uploads/user_avatars/4341944135105a5a661b36.jpg)
|
Posted: Tue Jan 22, 2013 8:38 pm Post subject: Re: Help? |
|
|
this is what im working with...
Turing: |
View.Set ("graphics:256;256")
var tiles : array 0 .. 14, 0 .. 14 of int
var grass : int := Pic.FileNew ("pics/grass.bmp")
var FileName : string := "map.txt"
var FileNo : int
open : FileNo, FileName, get
for y : 0 .. 14 % for every y
for x : 0 .. 14 %for every x
get : FileNo, tiles (x, y ) %get the tile type at (x,y)
end for
end for
close (FileNo )
for x : 0 .. 14
for y : 0 .. 14
if tiles (x, y ) = 1 then
Draw.FillBox (x * 16, y * 16, x * 16 + 16, y * 16 + 16, red) % the +10 is there because each tile is 10 by 10
else
Draw.FillBox (x * 16, y * 16, x * 16 + 16, y * 16 + 16, green)
end if
locate (5, 1)
delay (10)
%that just shows you what's going on if you still aren't sure
end for
end for
var key : array char of boolean
var px, py : int := 1 % we start off at grid 1,1.
%Note we don't begin at 2,2 because we set the first grid
%to 0,0 so everything is off by 1
loop
Input.KeyDown (key )
if key ('a') then
px - = 1
end if
if key ('d') then
px + = 1
end if
if key ('s') then
py - = 1
end if
if key ('w') then
py + = 1
end if
Draw.FillBox (px * 16, py * 16, px * 16 + 16, py * 16 + 16, grass )
View.Update
delay (50)
end loop
|
Mod Edit:
Please wrap you code in either of the following in order to preserve whitespace (indentation) and to highlight the syntax.
code: |
[syntax="turing"] ... code ... [/syntax]
[code] ... code ... [/code ]
|
|
|
|
|
|
![](images/spacer.gif) |
Zren
![](http://compsci.ca/v3/uploads/user_avatars/1110053965512db6185954b.png)
|
Posted: Wed Jan 23, 2013 12:53 am Post subject: RE:Help? |
|
|
You don't draw pictures with Draw.FillBox. You use Pic.Draw. You confused a pictureId with a colorId. |
|
|
|
|
![](images/spacer.gif) |
Sponsor Sponsor
![Sponsor Sponsor](templates/subSilver/images/ranks/stars_rank5.gif)
|
|
![](images/spacer.gif) |
Dazzle
![](http://compsci.ca/v3/uploads/user_avatars/4341944135105a5a661b36.jpg)
|
Posted: Sun Jan 27, 2013 11:04 am Post subject: RE:Help? |
|
|
lol.. thanks! |
|
|
|
|
![](images/spacer.gif) |
|
|