Page 1 of 1
[24 Jul 2009] Brushes
Posted: Sat Jun 13, 2020 5:32 pm
by Tarzin
Note: This is an archived post that was originally sent to the Hollywood mailing list on Fri, 24 Jul 2009 18:18:13 +0200
Hello,
Which is the maximum brushes number supported by Hollywood? May I preload 150 brushes?
Which solution is better:
- preload 150 brushes ?
- preload an IFF picture, cut, and then store 150 brushes in memory ?
It's for tiles game.
Thanks for advance for your advises!
Tarzin
http://www.amifrance.hw.tc/
[24 Jul 2009] Re: Brushes
Posted: Sat Jun 13, 2020 5:32 pm
by airsoftsoftwair
Note: This is an archived post that was originally sent to the Hollywood mailing list on Fri, 24 Jul 2009 18:24:37 +0200
Hello,
Which is the maximum brushes number supported by Hollywood?
As much as your memory can take
May I preload 150 brushes?
Sure.
Which solution is better: - preload 150 brushes ? - preload an IFF picture, cut, and then store 150 brushes in memory ?
I'd use the IFF picture and then use
DisplayBrushPart() to show the tiles. Then you only need a single brush which saves memory
[10 Aug 2009] Re: Brushes
Posted: Sat Jun 13, 2020 5:32 pm
by Tarzin
Note: This is an archived post that was originally sent to the Hollywood mailing list on Mon, 10 Aug 2009 18:59:15 +0200
I've started using displaybruspart () but have a problem with this part of code
Code: Select all
@BRUSH 2,"sprites.iff", {x=0, y=80, width=320, height=48}
@DISPLAY {title="Match-It!", x=#CENTER, y=#CENTER, width=320,
height=240, color = #GREEN}
text$=UpperStr("u")
posx=0 scry=0
for i=0 to StrLen(text$)-1
a=Asc(MidStr(text$,i,1))-64
Print (a,"")
Switch a
Case 1
scry=0
Case 2
a=a-20
scry=17
EndSwitch
DisplayBrushPart (2,(a-1)*16,scry,posx,50,16,16)
posx=posx+16
Next
Repeat
WaitEvent
Forever
In fact, values from 0 to 20 for "a" are for letters A to T Value 21 and more are for letters U to Z But my code is not working. It's only working if I use no switch command and use only letters from A to T
Can you help me?
Thanks!
Eric
[11 Aug 2009] Re: Brushes
Posted: Sat Jun 13, 2020 5:32 pm
by Allanon
Note: This is an archived post that was originally sent to the Hollywood mailing list on Tue, 11 Aug 2009 07:03:54 -0000
If I remember correctly the "Switch-EndSwitch" commands works only with constants, you can't use
Switch myvar
if myvar is a variable
Regards, Fabio
[11 Aug 2009] Re: Re: Brushes
Posted: Sat Jun 13, 2020 5:32 pm
by Tarzin
Note: This is an archived post that was originally sent to the Hollywood mailing list on Tue, 11 Aug 2009 19:26:35 +0200
Thanks for your help. I've tried this way but did not success too
Code: Select all
text$=UpperStr("test u")
posx=0 scry=0
for i=0 to StrLen(text$)-1
a=Asc(MidStr(text$,i,1))-64
Print (a,"")
if a>20 scry=16 a=a-19 Else scry=0
DisplayBrushPart (2,(a-1)*16,scry,posx,50,16,16)
posx=posx+16
Next
Repeat
WaitEvent
Forever
Error is "next without for"
Any idea?
Bye
Eric
[11 Aug 2009] Re: Brushes
Posted: Sat Jun 13, 2020 5:32 pm
by Allanon
Note: This is an archived post that was originally sent to the Hollywood mailing list on Tue, 11 Aug 2009 19:54:19 -0000
Hello Tarzin!! The solution is very simple: you have tested the string "test u" but the space has asc code = 32 so subtracting 64 from this code you have a negative value that break your script. I've tested with the string "testu" (removing the space) and all runs fine. You have to parse the string checking for special character with asc code < 64, for example if you encounter a space you can simply increase the current posx, and so on. Hope to have resolved you problem!!
Good coding! Fabio
P.S.: Here is your original code corrected (a Next was missing):
Code: Select all
@BRUSH 2,"sprites.iff", {x=0, y=80, width=320, height=48}
@DISPLAY {title="Match-It!", x=#CENTER, y=#CENTER, width=320,
height=240, color = #GREEN}
text$ = UpperStr("testu") ; <-- Space has asc code = 32 so here you have
a
; negative value which cause and error!
I've removed
; the space for simplicity.
posx = 0
scry = 0
For i = 0 To StrLen(text$)-1
a = Asc(MidStr(text$, i, 1)) - 64
DebugPrint (a, "")
If a>20
scry = 16
a = a - 19
Else
scry = 0
EndIf
DisplayBrushPart(2,(a-1)*16,scry,posx,50,16,16)
posx = posx + 16
Next
Repeat
WaitEvent
Forever
[12 Aug 2009] Re: Re: Brushes
Posted: Sat Jun 13, 2020 5:32 pm
by airsoftsoftwair
Note: This is an archived post that was originally sent to the Hollywood mailing list on Wed, 12 Aug 2009 00:25:18 +0200
If I remember correctly the "Switch-EndSwitch" commands works only with constants, you can't use
Switch myvar
if myvar is a variable
Nope, that's definitely not true. It wouldn't make much sense if you couldn't use Switch() with variables
[14 Aug 2009] Re: Re: Brushes
Posted: Sat Jun 13, 2020 5:32 pm
by Tarzin
Note: This is an archived post that was originally sent to the Hollywood mailing list on Fri, 14 Aug 2009 14:36:40 +0200
Here is your original code corrected (a Next was missing):
Thanks a lot for yout help, all run fine now! I'll try to adapt all my original Amos code to Hollywood. That's "the difficulty". My part of the game is done but in Amos.
See you soon with my next problem!
Eric
[15 Aug 2009] Re: Brushes
Posted: Sat Jun 13, 2020 5:32 pm
by Allanon
Note: This is an archived post that was originally sent to the Hollywood mailing list on Sat, 15 Aug 2009 21:36:36 -0000
My faulty memory!!
<Switch variable> is allowed but not <Case variable>, that's right?
Fabio
[17 Aug 2009] Re: Re: Brushes
Posted: Sat Jun 13, 2020 5:32 pm
by airsoftsoftwair
Note: This is an archived post that was originally sent to the Hollywood mailing list on Mon, 17 Aug 2009 22:11:50 +0200
My faulty memory!!
<Switch variable> is allowed but not <Case variable>, that's right?
Exactly
Case can only handle constants!