Code archives/Miscellaneous/The 168 Hour Pong Making Contest!

This code has been declared by its author to be Public Domain code.

Download source code

The 168 Hour Pong Making Contest! by Techlord
(Posted 19 years ago)
The 168 Hour Pong Making Contest!

Inspiration: mintybreath's Boredom.

Rules: Write it 168 hours. Blitz3D Source. Submit Source here! by 2007-09-20 00:00 GMT.

Criteria: Feature Count & Fun Factor.

Prize: I will be your personal Coding Slave for 24 hours.
mintybreath's enters the Contest with a Colorful Contender!!!

Comments

b32
(Posted 19 years ago)
Here is my entry:
Const autoplay = 0



Graphics 800, 600, 0, 2
SetBuffer BackBuffer()

HidePointer()

Level = 1

Type Ball
	Field x, y
	Field dx, dy
End Type

Type Obstacle
	Field x, y
	Field w, h
	Field dx, dy
	Field sm
End Type

b.Ball = New Ball
b\x = 0
b\y = 0
b\dx = 5
b\dy = 5

batx = 400
baty = 550

Message("Level 1 - Use mouse")

starttime = MilliSecs()

score = 0
OL = 1

Repeat

	Repeat
		ok = MilliSecs()
		Delay 1
	Until (ok - old) > 10 
	old = ok

	Level = ((Score + 7) / 13) + 1
	
	If Level > OL Then
		OL = Level
		
		Select Level
		
		Case 11
		
			Message("Congrats! End of game, and you won!")
			
			End
		
		Case 10
		
			Message("Level 10 - Obstacles! (Final round)")

			oz = 0
			For b.Ball = Each Ball
				b\x = oz * 80
				b\y = -oz * 75
				b\dx = 4 + oz/3
				b\dy = 4 + oz/3
				oz = oz + 3
			Next

			For c = 0 To 15
	
			o.Obstacle = New Obstacle
			o\sm = 7
			o\sm = 1
			o\x = Rand(800)
			o\y = Rand(400)
			o\w = Rand(25, 50)
			o\h = Rand(12, 30)
			
			Next
			
		Case 9
		
			Message("Level 9 - Various speeds!")
			
			oz = 0
			For b.Ball = Each Ball
				b\x = oz * 80
				b\y = -oz * 75
				b\dx = 2 + oz/3
				b\dy = 2 + oz/3
				oz = oz + 3
			Next
					
		
		Case 8
		
			Message("Level 8 - MultiBall!")
			Delete Each Obstacle
			Delete Each Ball
			For oz = 0 To 10 Step 3
				b.Ball = New Ball
				b\x = oz * 80
				b\y = -oz * 75
				b\dx = 4
				b\dy = 4
			Next
		
		Case 7
		
			Message("Level 7 - Obstacles Faster!")
			For o.Obstacle = Each Obstacle
				o\sm = 7
			Next
			Delete Last ball
			b.Ball = First Ball
			b\x =0
			b\y = 0
		
		Case 6
		
			Message("Level 6 - Obstacles Again!")
			
			b.Ball = First Ball
			b\x = 0
			b\y = 0
			
			b = After b
			b\x = 800
			b\y = 0

			For c = 0 To 15
	
			o.Obstacle = New Obstacle
			o\sm = 1
			o\x = Rand(800)
			o\y = Rand(400)
			o\w = Rand(25, 50)
			o\h = Rand(12, 30)
		
			Next
			
		Case 5
		
			Delete Each Obstacle
		
			Message("Level 5 - New Ball!")
			b.Ball = New Ball
			b\x = 0
			b\y = 0
			b\dx = 5
			b\dy = 5
			
		
		Case 4
		
			Message("Level 4 - Faster!")
			b.Ball = First Ball
			b\dx = 8
			b\dy = 8
		
		Case 3
		
			Message("Level 3 - Obstacles!")
			Delete Last Ball
			b.Ball = First Ball
			b\x = 0
			b\y = 0
			For c = 0 To 15
	
			o.Obstacle = New Obstacle
			o\sm = 1
			o\x = Rand(800)
			o\y = Rand(400)
			o\w = Rand(25, 50)
			o\h = Rand(12, 30)
		
			Next
			
		Case 2
		
			Message("Level 2 - New Ball!")			
			b.Ball = New Ball
			b\x = 0
			b\y = 0
			b\dx = 5
			b\dy = 5
			
		
		End Select

		
		
	End If

	Cls
	
	Text 200, 10, "Level:" + Level, 1, 0
	Text 600, 10, "Score:" + Score, 1, 0

	For b.Ball = Each Ball
		
	b\x = b\x + b\dx  
	b\y = b\y + b\dy

		If b\x <= 0 Then b\dx = Abs(b\dx)
		If b\x >= 799 Then b\dx = -Abs(b\dx)
		
		If b\y <= 0 Then b\dy = Abs(b\dy)
		If b\y >= 599 Then 
			b\dy = -Abs(b\dy)
			hit = hit + 1
			If hit > 2 Then 
				Tease: hit = 0
			Else
				Alarm()
			End If
		End If
		
		Oval b\x - 12, b\y - 12, 25, 25

		For o.Obstacle = Each Obstacle
			If RectsOverlap(b\x - 12, b\y - 12, 25, 25, o\x, o\y, o\w, 1) Then b\dy = -Abs(b\dy)
			If RectsOverlap(b\x - 12, b\y - 12, 25, 25, o\x, o\y + o\h - 1, o\w, 1) Then b\dy = Abs(b\dy)
			If RectsOverlap(b\x - 12, b\y - 12, 25, 25, o\x, o\y, 1, o\h) Then b\dx = -Abs(b\dy)
			If RectsOverlap(b\x - 12, b\y - 12, 25, 25, o\x + o\w - 1, o\y, 1, o\h) Then b\dx = Abs(b\dy)	
		Next

		If RectsOverlap(batx - 50, baty, 100, 4, b\x - 12, b\y - 12, 25, 25) Then 
		
			If ttest = 0 Then b\dy = -Abs(b\dy): Score = Score + 1: ttest = 1
			
		Else
			
			ttest = 0
		
		End If
		
		If RectsOverlap(batx - 50, baty + 20, 100, 4, b\x - 12, b\y - 12, 25, 25) Then b\dy = Abs(b\dy)
		If RectsOverlap(batx - 50, baty, 1, 24, b\x - 12, b\y - 12, 25, 25) Then b\dx = -Abs(b\dx)	
		If RectsOverlap(batx + 49, baty, 1, 24, b\x - 12, b\y - 12, 25, 25) Then b\dx = Abs(b\dx)	
	
	Next
		
	batx = batx + MouseXSpeed()
	
	If autoplay Then 
		miny = 0
		For b.Ball = Each Ball
			If b\y > miny Then
				miny = b\y
				aimx = b\x
			End If
		Next
		spd = Abs(aimx - batx)
		If spd > 15 Then spd = 15
		
		If miny > baty + 24 Then 
			batx = batx - 15
		Else
			batx = batx + Sgn(aimx - batx) * spd
		End If
	End If
	
	If batx < 50 Then batx = 50
	If batx > 750 Then batx = 750
	MoveMouse 400, 300
		
	Rect batx - 50, baty, 100, 24

	For o.Obstacle = Each Obstacle
		Rect o\x, o\y, o\w, o\h
		o\x = o\x + (o\dx *o\sm)
		If o\x < 0 Then o\x = o\x + 800
		If o\x > 800 Then o\x = o\x - 800
		If Rand(25) = 1 Then o\dx = Rand(-1, 1)
	Next	
	

	Flip
	
Until KeyHit(1)

End

Function Message(s$)

	SetBuffer FrontBuffer()
	Color 0, 0, 0
	For x = -3 To 3
	For y = -3 To 3
		Text 400 + x, 300 + y, s$, 1, 1
	Next
	Next
	Color 255, 255, 255
	Text 400, 300, s$, 1, 1
	Delay 1750
	SetBuffer BackBuffer()
	
End Function

Function Tease()

	Restore
		For g = 1 To Rand(10)
			Read t$
		Next
		
	Message(t$)
	
End Function

Data "What's the matter ? Going too fast ?"
Data "Come on, play like a man!"
Data "Hey ! Wake up .."
Data "Let's call it a day, okay ?"
Data "Man .. even I could do better than this"
Data "This is Pong! It is supposed to be an easy game.."
Data "Ow ow .. now where's that turbo button"
Data "Ehm .. you're supposed to bounce that white round thingie with the mouse"
Data "Oh look ! You're a real champion"
Data "Right.. but at least you're good with sports, right ?"

Function Alarm()

	For i = 0 To 10
		ClsColor 0, 0, (i Mod 2) * 255
		Cls
		Flip
		Delay 5
	Next

	
End Function



Jerome Squalor
(Posted 19 years ago)
 Graphics3D 1024,768,0,1
SetBuffer BackBuffer()
SeedRnd MilliSecs()

tex = CreateTexture(16,16)
	
	SetBuffer TextureBuffer(tex)
		
		Color 0,0,255
		Rect 0,0,16,16,0


wall_tex = CreateTexture(16,16)



	SetBuffer TextureBuffer(wall_tex)
	
	r = 255

	For x = 0 To 15

		Color r,255,0
		Line 0,x,16,x
		r = r - 15.9375
	
	Next
	
	ScaleTexture wall_tex,.1,.1
	
	tx# = 1
	ty# = 1
	
	

		
	SetBuffer BackBuffer()

t = MilliSecs()
ta = True

cam = CreateCamera()
	PositionEntity cam,-20,20,0
	RotateEntity cam,44,-90,0
	
lit = CreateLight(2)
	LightRange lit,5

Global type_ball = 1
Global type_player = 2
Global type_comp = 3
Global type_wall1 = 4
Global type_wall2 = 5

Type ball
	Field shape
	Field xv#,zv#
End Type

Type player
	Field shape
	Field zv#,zvv#
End Type

Type comp
	Field shape
	Field zv#
End Type

Type blurr
	Field shape
	Field a#
	Field h#,w#,d#
End Type

Type power
	Field shape
	Field kind
	Field x#,y#,z#
End Type

Global ball.ball,player.player,comp.comp,blurr.blurr,power.power

Global score = 0
Global compscore = 0

CreateBall()
CreatePlayer()
CreateComp()

Collisions type_ball,type_player,2,1
Collisions type_ball,type_comp,2,1
Collisions type_ball,type_wall1,2,2
Collisions type_ball,type_wall2,2,2
Collisions type_comp,type_wall1,2,2
Collisions type_comp,type_wall2,2,2
Collisions type_player,type_wall1,2,2
Collisions type_player,type_wall2,2,2


pl = CreatePlane()
	PositionEntity pl,0,-.3,0
	EntityTexture pl,tex
	EntityAlpha pl,.5
	FreeTexture tex

mir = CreateMirror()
	PositionEntity mir,0,-.3,0

wall1 = CreateCube()
	PositionEntity wall1,0,29.7,-15
	ScaleEntity wall1,30,30,.1
	EntityType wall1,type_wall1
	RotateEntity wall1,0,180,0	
	EntityTexture wall1,wall_tex
	EntityAlpha wall1,.25
	EntityRadius wall1,2

wall2 = CreateCube()
	PositionEntity wall2,0,29.7,15
	ScaleEntity wall2,30,30,.1
	EntityType wall2,type_wall2
	EntityTexture wall2,wall_tex
	EntityAlpha wall2,.25

	Delay 500

While Not KeyHit(1)
	
	Delay 1
	PositionTexture wall_tex,tx,ty
	
	ty = ty + -.1









UpdateBall()
UpdatePlayer()
UpdateComp()
UpdateBlurr()


UpdateWorld
RenderWorld

Text 0,0,"Computer Score: " + compscore
Text 0,12,"Player Score: " + score
Flip


Wend


Function CreateBall()

	b.ball = New ball
	
	b\shape = CreateSphere(5)
		EntityColor b\shape,255,155,0
	
	b\xv# = Rnd(-.5,.5)
	
	b\zv# = Rnd(-.5,.5)
	
	ScaleEntity b\shape,.5,.5,.5
	
	EntityType b\shape,type_ball
	
	EntityRadius b\shape,.5
	
	EntityShininess b\shape,1
	
End Function

Function UpdateBall()

	For v.ball = Each ball
		
		
		
		
		Blurr(v\shape,.45,.45,.45)
		
		
		If v\xv# < .3 And v\xv# > -.3
		
			v\xv# = Rnd(-.5,.5)
			
		EndIf
		
		If v\zv# < .3 And v\zv# > -.3
		
			v\zv# = Rnd(-.5,.5)
			
		EndIf
		
		
		If EntityCollided(v\shape,type_player) 
			
			v\zv# = Rnd(-.5,.5)
			
			v\xv# = Rnd(-.5)
			
			v\xv# = -v\xv#
				
		ElseIf EntityCollided(v\shape,type_comp)
		
			v\zv# = Rnd(-.5,.5)
			
			v\xv# = Rnd(.5)
			
			v\xv# = -v\xv#
			
		EndIf
		
		If EntityCollided(v\shape,type_wall1)
		
			v\zv# = -v\zv#
			
		ElseIf EntityCollided(v\shape,type_wall2)
		
			v\zv# = -v\zv#
			
		EndIf
		
		MoveEntity v\shape,v\xv#,0,v\zv#
		
		If EntityX(v\shape) < -17

		

			
			compscore = compscore + 1

			FreeEntity v\shape
			Delete v

			CreateBall()
			
			For p.player = Each player
			
				For t.comp = Each comp
				
						PositionEntity p\shape,-15,0,0		
						
						PositionEntity t\shape,28,0,0
						
				Next
				
			Next


		ElseIf EntityX(v\shape) > 30
		
			score = score + 1
			
			FreeEntity v\shape
			Delete v
			
			CreateBall()
			For p.player = Each player
			
				For t.comp = Each comp
				
						PositionEntity p\shape,-15,0,0		
						
						PositionEntity t\shape,28,0,0
						
				Next
				
			Next
			

			
		EndIf
				
		




	Next
	
End Function

Function CreatePlayer()

	p.player = New player
	
	p\shape = CreateCube()
	
	p\zv# = 0
	
	p\zvv# = .05
	
	ScaleEntity p\shape,.25,.25,2
	
	PositionEntity p\shape,-15,0,0

	EntityType p\shape,type_player

	EntityRadius p\shape,2

End Function

Function UpdatePlayer()

	For y.player = Each player
	
		If y\zv# <> 0
	
			Blurr(y\shape,.245,.245,1.9)
	
		EndIf
	
		MoveEntity y\shape,0,0,y\zv#
	
		If EntityCollided(y\shape,type_wall1) Or EntityCollided(y\shape,type_wall2)
		
			y\zv# = 0
			
		EndIf
	
	
		If KeyDown(203)
			
			If y\zv# < 1
			
				y\zv# = y\zv# + y\zvv#
			
			EndIf
			
		ElseIf KeyDown(205)
		
			If y\zv# > -1
		
			y\zv# = y\zv# - y\zvv#
			
			EndIf
			
		Else y\zv# = y\zv# * .9
		
		EndIf
		

		
	Next
	
End Function


Function CreateComp()

	c.comp = New comp
	
	c\shape = CreateCube()

	c\zv# = 0
	
	ScaleEntity c\shape,.25,.25,2
	
	PositionEntity c\shape,28,0,0

	EntityType c\shape,type_comp
	
	EntityRadius c\shape,2
	
End Function




Function UpdateComp()

	For n.comp = Each comp
		
		If n\zv# <> 0
		
			Blurr(n\shape,.245,.245,1.9)
	
		EndIf
	
		If EntityCollided(n\shape,type_wall1) Or EntityCollided(n\shape,type_wall2)
		
			n\zv# = 0
			
		EndIf
	
		For g.ball = Each ball
			

				If EntityZ(g\shape) > EntityZ(n\shape)
			
					If n\zv# < 1
			
					n\zv# = n\zv# + .03
				
					EndIf
				
				ElseIf EntityZ(g\shape) < EntityZ(n\shape)
			
					If n\zv# > -1
			
					n\zv# = n\zv# - .03
				
					EndIf
				
				EndIf
			

						
		Next
		

		
		MoveEntity n\shape,0,0,n\zv#
		
	Next
	
	
End Function


Function Blurr(obj,h#,w#,d#)

b.blurr = New blurr

b\shape = CopyEntity(obj)

b\a# = 1

b\h# = h#
b\w# = w#
b\d# = d#

	EntityParent b\shape,0
PositionEntity b\shape,EntityX(obj,1),EntityY(obj,1),EntityZ(obj,1)
RotateEntity b\shape,EntityPitch(obj,1),EntityYaw(obj,1),EntityRoll(obj,1)
ScaleEntity b\shape,b\h#,b\w#,b\d#
EntityAlpha b\shape,b\a#

End Function




Function UpdateBlurr()

For g.blurr = Each blurr

EntityAlpha g\shape,g\a#

If g\a# > 0

	g\a# = g\a# - .5
	
Else
	
	FreeEntity g\shape
	Delete g

EndIf

Next



End Function































End


Mortifer Nex
(Posted 19 years ago)
Never mind, just noticed you changed it

mintybreath
(Posted 19 years ago)
Hey guys. Here is my game. I couldnt figure out how to make anything using the in game designing, so it is a saved file with paddles i made in Paintshop

Here is the link.

http://rapidshare.com/files/56476270/Boredbb_Pong.ZIP.html


It is not that well finished. It is a little glitchy, but the deadline is tomorrow so i just had to get it out now. Sorry about any glitches that may occur. And the paddle is a little twitchy as well. :(

Sorry you have to download it. :)

Mortifer Nex
(Posted 19 years ago)
Ripoff of Kong. :P

Jerome Squalor
(Posted 19 years ago)
cool mintybreath

b32
(Posted 19 years ago)
Yes, very nice. :)

mintybreath
(Posted 19 years ago)
Ripoff of Kong. :P


Whats kong?

And anyway, i may re enter, and fix some of the glitches since the deadline was pushed back.

Mortifer Nex
(Posted 19 years ago)
Does look a lot like Kong from Game Programming for Teens Second Edition...

mintybreath
(Posted 19 years ago)
Never read it. Probably a coincidence. What about it looks like Kong?

And if Kong is just a copy off of pong like mine was, then it probably just looks like Pong. That kinda makes more sense.

Jerome Squalor
(Posted 19 years ago)
it just looks the same because Kong also had 2 paddles on a black screen.
Maybe if you add some kind of special effects(background,particles,stars,powerups,etc...) it will look more original.

mintybreath
(Posted 19 years ago)
Oh, the only reason it was 2 paddles on a black screen was because i didnt make a background yet. I probably will, my pong version isnt really even done yet. I just entered it because that was the due date, and i figured, " Might as well get it out there"

I will change alot more though

Mortifer Nex
(Posted 19 years ago)
Nah, the scores are in the same place, when someone scores... Just looks the same...

mintybreath
(Posted 19 years ago)
I put the scores in the upper right corner because that seemed like the best spot. It just occured to me first.

And you think i copied off of this Kong game because my scores are in the same spot? really?

How could my game look like Kong when i made all the paddles and ball myself. The only way it could look alike is if i used the same exact paddles and stuff, considering those are the only significant things in my game. And hopefully the paddles look nothing like Kong's paddles, or that would be wierd.

mintybreath
(Posted 19 years ago)
This just in!

I may know somewhat about what you are talking about. I still have no idea what this Kong thing is, but when i was first making the game, i had some help from some website i found. They had a Pong sort of game on it too. I used a little of the code from that, some of the source code. I wasnt sure how to do a few things, that is why. I wish i could remember the name of the site though... :(

Any way, i did that a while ago, before the contest started, when i was making Pong for the fun of it. I really had no intention of copying a game, I just needed some source code because i was not sure how to make it, or start it.

Nilium
(Posted 19 years ago)
How could it possibly take you this long to make a Pong clone?

mintybreath
(Posted 19 years ago)
I am not a coding guru.

I guess i would be considered a coding noob. I am only 14, and i know mostly just the basics.

Jerome Squalor
(Posted 19 years ago)
I didn't know you're 14, I'm 13! :D

Jerome Squalor
(Posted 19 years ago)
So is this contest over yet??

mintybreath
(Posted 19 years ago)
I didn't know you're 14, I'm 13! :D


you r? Cool. :)

And i dont know if this is over yet either.

Mortifer Nex
(Posted 19 years ago)
Nah, it only looks the same when you score. Was just the first thing that came to me...

Jerome Squalor
(Posted 19 years ago)
I think we should make another contest like this, It was really fun.

mintybreath
(Posted 19 years ago)
Ya we really should.
Like a...hmm....

72 hour pacman making contest, or something like that? :)

Lol. 48 hour Halo making contest.
That would be cool, but probably not a big enough due date. And way too hard.

Jerome Squalor
(Posted 19 years ago)
ya

Jerome Squalor
(Posted 19 years ago)
ok, seriously FPS, Who won?

Mortifer Nex
(Posted 19 years ago)
lol yeah
I was thinking of doing a 168 hour asteroid contest until I gave away the prize =D

Now you can get it here:
http://www.syntaxbomb.com/forum/index.php?action=tpmod;dl=item26

The catapult was the prize =D

Jerome Squalor
(Posted 19 years ago)
I thought the prize was 24 hours of coding anything?

Mortifer Nex
(Posted 19 years ago)
That was FPS's prize, I said that I was about to do a 168 hour asteroid contest, but I gave away the prize. The winner of this contest is 24 hours of coding ;)

Jerome Squalor
(Posted 19 years ago)
that's what i want to know, who won THIS contest?

Mortifer Nex
(Posted 19 years ago)
Me wanna know too.
Wait...
Judges: Blitz Community. Cast your Votes here.


Kip has won.

Jerome Squalor
(Posted 19 years ago)
I won??!!??!!?? :D

CodeD
(Posted 19 years ago)
[
[ O
[

Ahhh, it's over already? XD

Code Archives Forum