A Lame Program

Community Forums/Showcase/A Lame Program

Yo! Wazzup?(Posted 2007) [#1]



Any colors I should add?



*edit* I should of changed the title...
For B3D/B+


H&K(Posted 2007) [#2]
Your indentation should be
Global w
Global x=255
Global y
	While Not KeyDown(1)
		While MouseDown(1)
			Color w,y,x
					
			If KeyHit(2) Then
				x=255
				w=0
				y=0
			EndIf
			If KeyHit(3) Then
				x=0
				w=255
				y=0
			EndIf
			If KeyHit(4) Then
				x=0
				w=0
				y=255
			EndIf
			If KeyHit(5) Then
				x=255
				w=255
				y=255
			EndIf
			If KeyHit(6) Then
				x=255
				w=255
				y=0
			EndIf								
			If KeyHit(7) Then
				x=255
				w=0
				y=255
			EndIf	
			If KeyHit(8) Then
				x=0
				w=255
				y=255
			EndIf
			Oval MouseX(),MouseY(),10,10,1
		Wend
		If KeyHit(14) Then
			Cls
		EndIf
	Wend
End
Also you might concider "Select/Case" instead of the Ifs http://www.blitzmax.com/b3ddocs/command.php?name=Select&ref=2d_a-z Or at the least changing If endif If endif to IF elseIF elseIF ect http://www.blitzmax.com/b3ddocs/command.php?name=ElseIf&ref=2d_a-z
At the moment if keyhit is 2, your program is still checking that Keyhit is 3 etc, which you know it cannot be


t3K|Mac(Posted 2007) [#3]
please stop spamming the forums with such stuff. thank you!


Yo! Wazzup?(Posted 2007) [#4]
Ok.


jfk EO-11110(Posted 2007) [#5]
Hey it's really lame - he said the truth :)


Ked(Posted 2007) [#6]
Isn't this where you post "FINISHED" products? Yes? Thats what I thought


Stevie G(Posted 2007) [#7]
IMO, the showcase is for anything you want to show to people for feedback. Logically this means if could be a WIP, Prototype, Proof of Concept, Alpha, Beta or a finished product.

I don't see what the issue is and why anyone really cares. True, the program is pretty lame but if he wants to show it off then what harm is it doing?!

Stevie


Ash_UK(Posted 2007) [#8]
I agree with Stevie G :o)


(tu) ENAY(Posted 2007) [#9]
Hey, nice work!


CS_TBL(Posted 2007) [#10]
As long as it doesn't end up in the code archives, which I've seen people do with similar programs..


big10p(Posted 2007) [#11]
heh - this community is harsh! :P


H&K(Posted 2007) [#12]
Whats the problem?
If we are only allowed to post really good stuff, how are beginers going to get good?

Its a SHOWCASE of an indiviguals work, not a showcase of Blitz.


Ked(Posted 2007) [#13]
If we are only allowed to post really good stuff, how are beginers going to get good?

They begin in the Blitz3D/BlitzPlus/BlitzMax Beginners Area Forums.


H&K(Posted 2007) [#14]
They begin in the Blitz3D/BlitzPlus/BlitzMax Beginners Area Forums
Then only users of each lang get to see them. And I think your wrong anyway. Thats where you post to learn or ask or teach. Here is were to post to simply show people what you have done.

I, probably like a lot of people, learnt to program at WH Smiths, (Or the equvilant), by messing on their display computers. And some of the crap programs you would write whilst there although crap, you wanted people to look at, so would pursuade the cashier to leave/put them on the main screen. That was my showcase.

Now, I think it is totaly out of order to tell people that what they have posted here, is not good enough to be posted here. No matter how simple, or baddly written it is in your opinion. For all means comment apon it and critise it, but dont tell anyone that their program doesnt deserve to be shown to anyone.

Its bad enough if family dont want to look at your program, but when your programming comunity wants to refuse to let you showcase something that you are proud of, is a bit much.


Torrente(Posted 2007) [#15]
Personally, I don't mind beginners posting their finished (or unfinished) work. It helps them improve by getting feedback, and is often amusing.


jfk EO-11110(Posted 2007) [#16]
I remember when I made this program:

repeat
if mousedown(1) then plot mousex(),mousey()
until mousedown(2)

I was very proud. Unfortunately there was no internet at that time.


Neuro(Posted 2007) [#17]
Oh..heh...I thought it said "A Lane Program".....


Yo! Wazzup?(Posted 2007) [#18]
Oh..heh...I thought it said "A Lane Program".....

Here... You want a lane program?
Graphics 800,600,0,1
Line 300,0,300,600
Line 500,0,500,600
Line 400,0,400,600
Color 0,0,0
Line 400,25,400,75
Line 400,100,400,150
Line 400,175,400,225
Line 400,250,400,300
Line 400,325,400,375
Line 400,400,400,450
Line 400,475,400,525
Line 400,550,400,590
Delay 5000
End



stayne(Posted 2007) [#19]
Carmack would be proud.


Matt Vinyl(Posted 2007) [#20]
Its bad enough if family dont want to look at your program


Totally! I remember my first program, just a simple 'collect the falling presents' thing I made for my two younger brothers. I'd been working on it for ages (I was only 12 - and that was 15 years back) and just got it working when Dad stormed upstairs and pulled the plug out as it was 'too late'!!! I had no chance of saving it to 'Amiga Floppy'... :(

Men shouldn't often cry... ...but I did then!

(Fair do, I was only 12!)


caff_(Posted 2007) [#21]
I think you should be allowed to post anything you've created in this forum. Fair enough if you want to critique the work of others, or simply say you're not too impressed with the quality or length of code.

Matt that's a very sad story. I only hope you mention this to your dad on a regular basis :)


Matt Vinyl(Posted 2007) [#22]
Agreed!

Yes, it is often the 'drive' that pushes me to finish things and save regularly, so in a round-about way, he did me a favour!


Kev(Posted 2007) [#23]
I have no problems and enjoy looking over some of Yo! Wazzup? posts. it takes me back to my own early coding days, we all had to start somewere.


Totally! I remember my first program, just a simple 'collect the falling presents' thing I made for my two younger brothers. I'd been working on it for ages (I was only 12 - and that was 15 years back) and just got it working when Dad stormed upstairs and pulled the plug out as it was 'too late'!!! I had no chance of saving it to 'Amiga Floppy'... :(


i bet the following night you worked faster :P


Yo! Wazzup?(Posted 2007) [#24]
Yeah, I'm surprised. A lot of people don't care about this topic being here.
(Though, if no one here knew I was nine, well, that would be a different story :-O) Also, I'm typing slow right now because I'm surfing the internet through my Wii- I got to go to school- bye!


BlackJumper(Posted 2007) [#25]
*sigh*

I miss Agamer !!!


AJirenius(Posted 2007) [#26]
Oh.. those times... C64 inbuild Basic was the best! Next is Amos.


agent4125(Posted 2007) [#27]
I say keep it coming. I like seeing what the youngsters are up to. That's one thing I miss from the old BlitzCoder community, which keeps self-destructing every year.

Anyway, suggestion: instead of adding new colors, try adding a row of boxes on the bottom of the screen to show which colors correspond to which keys, so the user knows how to use it without reading the code. Also, highlight the box for the currently selected color.


Rob Farley(Posted 2007) [#28]
A few key changes here I should point out.

1: Put the colours into an array
2: Positions the oval at mousex()-5 and mousey()-5 so the centre of the circle is where the mousepointer is as an oval is drawn from the top left not the centre.

; Set up Colours
Dim Colours(8,2)
Data 255,0,0
Data 0,255,0
Data 0,0,255
Data 255,255,255
Data 255,255,0
Data 255,0,255
Data 0,255,255

For n=2 To 8
	Read Colours(n,0),Colours(n,1),Colours(n,2)
Next


While Not KeyDown(1)
	
	; Check for colour Change
	For n=2 To 8
		If KeyDown(n) Then Color Colours(n,0),Colours(n,1),Colours(n,2)
	Next

	; Draw
	If MouseDown(1) Then Oval MouseX()-5,MouseY()-5,10,10,1
	
	; Clear Screen	
	If KeyHit(14) Then Cls
Wend



Yo! Wazzup?(Posted 2007) [#29]




This better.


clownhunter(Posted 2007) [#30]
Sorry to get off topic, but OMG Rob, where have you been? :O Your latest posts go from 10 months ago to 2 days ago. O_o

Back on topic:
I'd try making it so you can click on the color to change the color you're drawing with.


Yo! Wazzup?(Posted 2007) [#31]
I don't know how to look at where the mouse was clicked, only check if the mouse was clicked with MouseHit()/MouseDown()
Or can you go like this:

For x=1 To 100
If MouseDown(1) And Mousex()=x Then
;Do this
EndIf



I'll try this in compiler.


clownhunter(Posted 2007) [#32]
I would have something like
x = MouseX()
y = MouseY()

Then I'd have something like:
If x > # and x < # and y > # and y < # and MouseDown(1)
;change color
EndIf

# being x and y of the color you're clicking on.

Of course I'm not that great of a programmer so checking with someone good would probably best the best action.


CS_TBL(Posted 2007) [#33]
I'd use => and <= instead of > and < as one typically gives an area in which to check. The borders of such an area (e.g. the pixels on the edge of the area) count as well then.


Matt Vinyl(Posted 2007) [#34]
That's the best way to kick off learning programming if you ask me. Put something really basic together, then add more and more little bits into it. Even if what you end up is ultimately 'useless' to anyone but your own learning experience, it doesn't matter!

Good luck mate, and good to see someone starting at that age, if you keep at it, you'll have some great software knocked up when you're older! ;)


Rob Farley(Posted 2007) [#35]
I'd take a look at the rectsoverlap function

ie

If rectsoverlap(x,y,width,height,mousex(),mousey(),1,1) and mousedown(1) then 'set colour'

Also I'd load this into a function so you get something like:

; Set up Colours
Dim Colours(8,2)
Data 255,0,0
Data 0,255,0
Data 0,0,255
Data 255,255,255
Data 255,255,0
Data 255,0,255
Data 0,255,255

For n=2 To 8
	Read Colours(n,0),Colours(n,1),Colours(n,2)
Next

; Set the default colour
SelectedColor = 2

Repeat

; Draw the buttons and change colour if the mouse is clicked
For n=2 To 8
	If colourbutton(n*20,0,Colours(n,0),Colours(n,1),Colours(n,2)) Then SelectedColor = n
Next

; Draw a block of the selected colour
Color Colours(SelectedColor,0),Colours(SelectedColor,1),Colours(SelectedColor,2)

Rect 0,20,400,40


Until KeyHit(1)


Function ColourButton(x,y,r,g,b)
	Over = False

	; Check if the mouse is over a button and set the over flag
	If RectsOverlap(x,y,16,16,MouseX(),MouseY(),1,1) Then Over = True
	
	; If the mouse is over a button set the border colour to white, otherwise make it grey
	If Over Then Color 255,255,255 Else Color 100,100,100
	
	; Draw the border
	Rect x,y,16,16,False
	
	; set the colour to the passed colour and draw the rect in the middle of the border
	Color r,g,b
	Rect x+1,y+1,14,14,True
	
	; if you're pressing the mouse and you're over the button return true else return false
	If MouseDown(1) And over Then Return True Else Return False
End Function