Bizarre... I'll fix that... Idk what happened...
Fixed, and....
V5! The only thing that changed is Options, and Instructions...
Check em out!
[REMOVED]
[EDIT]
V6 is out now, containing EVEN MORE music, an upgraded loading menu, an a timer that keeps people from glitching and raises FPS by... 100!!!!! It's almost time for credits... check out the project goals. If you do one or two, you'll be in it. Of course these people will be in it:
-Obese (What more should I say?)
-Latch (Don't we always owe him?)
-TDK (Without his tutorials, and one of his posts on sprite collision, this wouldn't be working
)
-BN2 Productions (Helped me out with timers when I was noob#-5)
And... V6:
`Project Goals:
`-Better Physics
`-Powerups (after physics)
`-Intro/Team Logo
`-Credits
`-Levels
`-Bosses
`-------------------------------------
`The Noob Game Devolopment Team: Pong
`-------------------------------------
hide mouse
`set this to 1 if you don't have the music/sound
`You cannot enter Options if you don't have music/sound
music=0
`Intro:
center text 320,240,"Loading Music..."
`Rem these out if you don't have the sounds. Then set music to 1. They can be found under Media>Media Browser
load sound "hitball.wav",1
load sound "ping.wav",2
load music "Dodge This.mid",3
load music "wind.wav",1: `This is actually found under Sound, but it doesn't repeat it so much if i label it music
load music "Guess.mid",2
cls
center text 320,240,"Loading Numerals.."
cls
sync rate 0
gree=155
direct=0
p1y#=240
bx#=320
by#=240
cy#=240
direct=1
center text 320,240,"Loading Sprites..."
Generate_Pong_Image
Create_Main_Paddles(2,3)
Ball_Generate(1,3)
r=rnd(1)+1
sync rate 0
create_mouse(5)
cls
generate_menu_sprites
ink rgb(0,255,0),0
redo:
`!-------=========---=THE MAIN LOOP FOR MENU---========------!
do
if music=0 then play music 3
if music_stop=1 then stop music 3
sprite 5,280,40,4
sprite 6,mousex(),mousey(),5
sprite 7,300,200,7
sprite 8,300,230,8
sprite 9,300,260,9
`Scale the sprites to normal
scale sprite 7,100:scale sprite 8,100:scale sprite 9,100
if sprite collision(6,7) and mouseclick()=1 then exit
if sprite collision(6,7) then scale sprite 7,120
if music=0 and sprite collision(6,7) then play music 1
if sprite collision(6,8) and mouseclick()=1 then gosub Instructions
if sprite collision(6,8) then scale sprite 8,120
if music=0 and sprite collision(6,8) then play music 1
if sprite collision(6,9) and mouseclick()=1 then gosub Options
if sprite collision(6,9) then scale sprite 9,120
if music=0 and sprite collision(6,9) then play music 1
if music=0 then stop music 1
sync
loop
`!-------=========---=|THE MAIN LOOP FOR MENU|---========------!
`Hide the Menu,cls and stop music
if music=1 then stop music 3
hide sprite 6:hide sprite 5:hide sprite 7:hide sprite 8:hide sprite 9:cls
`|Hide the Menu,cls and stop music|
hide mouse
`-------=========---=THE MAIN LOOP FOR PONG---========------
do:cls rgb(15,25,15)
`if music=0 then loop music 3
print screen fps()
sprite 4,280,0,4
if p1y#>=420 then disable=1 else disable=0
if p1y#<=0 then disable_2=1 else disable_2=0
sprite 2,40,p1y#,2
sprite 1,bx#,by#,1
sprite 3,600,cy#,3
`--Reset if Ball passes Player's side---
if bx#>=638 then bx#=320:r=2:by#=240:t=0:wait 1000
if bx#<=1 then bx#=320:r=1:y#=240:t=0:wait 1000
`--|Reset if Ball passes Player's side|---
`Change Directions for ball maintenance
bx#=bx#*direct
`--------
`Sprite collision to check sides
if sprite collision(3,1) then r=2
if sprite collision(2,1) then r=1
if upkey()=1 and disable_2=0 then dec p1y#,.5
if downkey()=1 and disable=0 then inc p1y#,.5
if returnkey()=1 then inc cy#,1
if r=1 then inc bx#,1
if r=2 then dec bx#,1
` Determine Sprite Collision and flip "Pong" symbol. + play sound
if sprite collision(2,1) then oldp#=p1y#:start=1:flip sprite 4:scorewait_1=1
if sprite collision(3,1) then oldp#=cy#:start=1:flip sprite 4:scorewait_2=1
if sprite collision(2,1) and music=0 then play sound 1
if sprite collision(3,1) and music=0 then play sound 1
if sprite collision(2,1) and scorewait=0 and waiting1=0 then inc pscore#,1
if sprite collision(3,1) and scorewait2=0 and waiting2=0 then inc cpuscore#,1
if start=1
if oldp#<by# then dec by#,.05
if oldp#+1<by# then mega_curve=1:`play sound 2
if oldp#>by# then inc by#,.05
if by#<oldp# then inc by#,.09
if oldp#=by# then start=0
endif
print "waiting1:",waiting1
print "waiting2:",waiting2
if scorewait_1=1
if waiting1<490 then inc waiting1,1 else scorewait=0:waiting1=0:scorewait_1=0
endif
if scorewait_2=1
if waiting2<500 then inc waiting2,1 else scorewait2=0:waiting2=0:scorewait_2=0
endif
`--Making Mega_curve
If mega_curve=1 and hit=0
if by#<478 then inc by#,curve#
if curve#<1 then inc curve#,.01
endif
if by#<=400 then hit=1
`--|Making Mega_curve|--
if by#>=479 then t=1
if by#<=2 then t=2
print t
if t=1 then dec by#,1
if t=2 then inc by#,1
`--Handle CPU--
perfection=rnd(1)
if by#>cy# and perfection=1 then inc cy#,.8
if by#<cy# and perfection=1 then dec cy#,.8
`--|Handle CPU|--
ink rgb(255,10,0),0
set text size 20
center text 140,0,"P1 Score:"+str$(pscore#)
ink rgb(10,255,10),0
set text size 20
center text 500,0,"CPU Score:"+str$(cpuscore#)
ink rgb(255,255,255),0
text 280,100," Score to win: 30"
if pscore#=30 then gosub pwin
if cpuscore#=30 then gosub cpuwin
sync
loop
`-------=========---=|THE MAIN LOOP FOR PONG|---========------
`----------FUNCTIONS---------
function Create_Main_Paddles(image1,image2)
ink rgb(255,10,0),0
box 10,10,20,80
get image image1,10,10,20,70
cls
ink rgb(10,255,0),0
box 10,10,20,80
get image image2,10,10,20,70
cls
endfunction
function Ball_generate(image3,radius)
ink rgb(10,0,255),0
sync on:sync rate 0
radius#=radius
oldradius#=radius
while radius#>0
dec radius#,1
circle 320,240,radius#
sync
endwhile
get image image3,300,200,340,280
cls
endfunction
function Generate_Pong_Image
sync on:sync rate 0
y=0
sync
for row=0 to 8
inc y,8
x=0
for col=0 to 16
sync
ink rgb(0,255,0),0
inc x,6
read somedata
if somedata=1
box x,y,x+4,y+4
endif
sync
next col
sync
next row
data 0,0,1,1,0,0,0,0,0,0,0,0,0,0,0,0,0
data 0,0,1,0,1,0,0,0,0,0,0,0,0,0,0,0,0
data 0,0,1,1,0,1,1,1,0,1,1,1,0,1,1,1,0
data 0,0,1,0,0,1,0,1,0,1,0,1,0,1,0,1,0
data 0,0,1,0,0,1,1,1,0,1,0,1,0,1,1,1,0
data 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,0
data 0,0,0,0,0,0,0,0,0,1,1,0,0,0,0,1,0
data 0,0,0,0,0,0,0,0,0,1,1,1,1,1,1,1,0
get image 4,0,0,200,70
cls
sync rate 30
ink rgb(255,255,255),0
endfunction
function create_mouse(radius)
ink rgb(100,g,100),0
while radius>0
ink rgb(100,gre,100),0
dec gre,10
dec radius,1
circle 320,240,radius
sync
endwhile
get image 5,300,200,340,260
endfunction
function generate_menu_sprites
ink rgb(100,200,50),0
text 0,0,"Play"
get image 7,0,0,50,50
cls
ink rgb(20,100,200),0
text 0,0,"Instructions"
get image 8,0,0,100,50
cls
ink rgb(255,20,20),0
text 0,0,"Options"
get image 9,0,0,80,50
cls
endfunction
`GAME ENDING VARIABLES
pwin:
if sound=0 and music=0 then play sound 2
hide sprite 4:hide sprite 1:hide sprite 2:hide sprite 3
repeat
cls rgb(0,255,0):ink rgb(0,255,0),0:wait 100
center text 320,240,"You beat the CPU!"
cls rgb(0,0,0):ink rgb(0,0,0),0:wait 100
center text 320,240,"You beat the CPU!"
ten=ten+1
if sound=0 and music=0 then play sound 2
sync
until ten=10
ink rgb(255,255,255),0
center text 320,240,"You beat the CPU!"
suspend for key
stop sound 2
end
cpuwin:
if sound=0 and music=0 then stop music 3
if sound=0 and music=0 then play music 2
hide sprite 4:hide sprite 1:hide sprite 2:hide sprite 3
cls
center text 320,240,"Failure."
suspend for key
end
`|GAME ENDING VARIABLES|
`MENU
Instructions:
5yy=40
5xx=280
7xx=300
7yy=200
8xx=300
8yy=230
9xx=300
9yy=260
flip sprite 7
mirror sprite 9
bigger=100
smaller#=100
smallval#=.005
do:cls
if smaller#>=1 then dec smaller#,smallval# else exit
if bigger<200 then inc bigger,1
if bigger=200 and 8yy>40 then dec 8yy,1
if bigger=200 and 8yy=40 and 8xx>220 then dec 8xx,1
if music=0 then play music 3
if music_stop=1 then stop music 3
sprite 5,5xx,5yy,4
sprite 6,mousex(),mousey(),5
sprite 7,7xx,7yy,7
sprite 8,8xx,8yy,8
sprite 9,9xx,9yy,9
7xx=7xx+2
if 9xx<0 then 9xx=9xx-1
if 9yy<500 then 9yy=9yy+1
scale sprite 8,bigger
scale sprite 5,smaller#
inc smallval#,.002
sync
loop
sync
cls
print
print
print
print
print
print
print " Use your paddle to Keep the Ball alive.. and get it past your opponent!"
print " Press a Key to Begin."
suspend for key
cls
flip sprite 7
mirror sprite 9
scale sprite 5,100
gosub redo
Options:
sprite_x#=280
huge_=100
do
sprite 5,sprite_x#,40,4
scale sprite 5,huge_
if huge_<500 then inc huge_,1 else exit
dec sprite_x#,.5
sync
loop
hide sprite 7
hide sprite 8
hide sprite 9
cls
ink rgb(255,0,0),0
center text 490,290,"Sound On?"
center text 490,310,"(y)es (n)o"
set text size 80
center text 490,90,"Options"
do
if inkey$()="y" then sound=0:cls:exit
if inkey$()="n"
sound=1:music_stop=1:cls
set text size 10
show sprite 7
show sprite 8
show sprite 9
scale sprite 5,100
return
endif
sync
loop
if music_stop=1 then music_stop=0:play music 3
show sprite 7
show sprite 8
show sprite 9
scale sprite 5,100
set text size 10
return
`|MENU|
end
[EDIT!
]
FINALLY! After hours of work and a long night, I figured out the physics! It was hard, but here's the basis:
I'm going to be out of town for most of today, but I might have this finished before the end of today.
[CODE REMOVED]
[NEW CODE ADDED]
[PHYSICS FOR BOTTOM BOUNCE COMPLETE!]
!
6.5, coming next, the other directional bounce.
!
`Project Goals:
`-Better Physics
`-Powerups (after physics)
`-Intro/Team Logo
`-Credits
`-Levels
`-Bosses
`--------PROBLEM!--------
`+====Ball doesn't go down after superbounce====+
`-------------------------------------
`The Noob Game Devolopment Team: Pong
`-------------------------------------
hide mouse
`set this to 1 if you don't have the music/sound
`You cannot enter Options if you don't have music/sound
music=1
`Intro:
center text 320,240,"Loading Music..."
`Rem these out if you don't have the sounds. Then set music to 1. They can be found under Media>Media Browser
cls
center text 320,240,"Loading Numerals.."
cls
sync rate 0
gree=155
direct=0
p1y#=240
bx#=320
by#=240
cy#=240
direct=1
center text 320,240,"Loading Sprites..."
Generate_Pong_Image
Create_Main_Paddles(2,3)
Ball_Generate(1,3)
r=rnd(1)+1
sync rate 0
create_mouse(5)
cls
generate_menu_sprites
ink rgb(0,255,0),0
redo:
mega_curve=0
`!-------=========---=THE MAIN LOOP FOR MENU---========------!
do
if music=0 then play music 3
if music_stop=1 then stop music 3
sprite 5,280,40,4
sprite 6,mousex(),mousey(),5
sprite 7,300,200,7
sprite 8,300,230,8
sprite 9,300,260,9
`Scale the sprites to normal
scale sprite 7,100:scale sprite 8,100:scale sprite 9,100
if sprite collision(6,7) and mouseclick()=1 then exit
if sprite collision(6,7) then scale sprite 7,120
if music=0 and sprite collision(6,7) then play music 1
if sprite collision(6,8) and mouseclick()=1 then gosub Instructions
if sprite collision(6,8) then scale sprite 8,120
if music=0 and sprite collision(6,8) then play music 1
if sprite collision(6,9) and mouseclick()=1 then gosub Options
if sprite collision(6,9) then scale sprite 9,120
if music=0 and sprite collision(6,9) then play music 1
if music=0 then stop music 1
sync
loop
`!-------=========---=|THE MAIN LOOP FOR MENU|---========------!
`Hide the Menu,cls and stop music
if music=0 then stop music 3
hide sprite 6:hide sprite 5:hide sprite 7:hide sprite 8:hide sprite 9:cls
`|Hide the Menu,cls and stop music|
hide mouse
`-------=========---=THE MAIN LOOP FOR PONG---========------
do:cls rgb(15,25,15)
if by#>455 then up=1
if by#<2 then down=1:up=0
oldby#=by#
print screen fps()
sprite 4,280,0,4
if p1y#>=420 then disable=1 else disable=0
if p1y#<=0 then disable_2=1 else disable_2=0
sprite 2,40,p1y#,2
sprite 1,bx#,by#,1
sprite 3,600,cy#,3
`--Reset if Ball passes Player's side---
if bx#>=638 then bx#=320:r=2:by#=240:t=0:wait 1000
if bx#<=1 then bx#=320:r=1:y#=240:t=0:wait 1000
`--|Reset if Ball passes Player's side|---
`Change Directions for ball maintenance
bx#=bx#*direct
`--------
`Sprite collision to check sides
if sprite collision(3,1) then r=2
if sprite collision(2,1) then r=1
if upkey()=1 and disable_2=0 then dec p1y#,.5
if downkey()=1 and disable=0 then inc p1y#,.5
if returnkey()=1 then inc cy#,1
if r=1 then inc bx#,1
if r=2 then dec bx#,1
` Determine Sprite Collision and flip "Pong" symbol. + play sound
if sprite collision(2,1) then oldp#=p1y#:start=1:flip sprite 4:scorewait_1=1
if sprite collision(3,1) then oldp#=cy#:start=1:flip sprite 4:scorewait_2=1
if sprite collision(2,1) and music=0 then play sound 1
if sprite collision(3,1) and music=0 then play sound 1
if sprite collision(2,1) and scorewait=0 and waiting1=0 then inc pscore#,1
if sprite collision(3,1) and scorewait2=0 and waiting2=0 then inc cpuscore#,1
if start=1
if oldp#<by# then dec by#,.05
if oldp#+3<by# then mega_curve=1:`play sound 2
if oldp#>by# then inc by#,.05
if by#<oldp# then inc by#,.09
if oldp#=by# then start=0
endif
print "waiting1:",waiting1
print "waiting2:",waiting2
if scorewait_1=1
if waiting1<490 then inc waiting1,1 else scorewait=0:waiting1=0:scorewait_1=0
endif
if scorewait_2=1
if waiting2<500 then inc waiting2,1 else scorewait2=0:waiting2=0:scorewait_2=0
endif
`--Making Mega_curve
If mega_curve=1
if by#<478 then inc by#,curve#
if curve#<1 then inc curve#,.01
endif
if by#<=400 then hit=1
`--|Making Mega_curve|--
if by#>=479 then t=1
if by#<=2 then t=2
print t
if t=1 then dec by#,1
if t=2 then inc by#,1
`--Handle CPU--
perfection=rnd(1)
if by#>cy# and perfection=1 then inc cy#,.8
if by#<cy# and perfection=1 then dec cy#,.8
`--|Handle CPU|--
ink rgb(255,10,0),0
set text size 20
center text 140,0,"P1 Score:"+str$(pscore#)
ink rgb(10,255,10),0
set text size 20
center text 500,0,"CPU Score:"+str$(cpuscore#)
ink rgb(255,255,255),0
text 280,100," Score to win: 30"
if pscore#=30 then gosub pwin
if cpuscore#=30 then gosub cpuwin
if up=1 then change#=oldby#+by#
if down=1 then change#=oldby#-by#
if up=1 then dec by#,slowchange#+.2
if down=1 then dec by#,slowchange#+.2
if ctimer<300 then slowchange#=change#/300 else ctimer=0:slowchange#=0:up=0:down=0:mega_curve=0
sync
loop
`-------=========---=|THE MAIN LOOP FOR PONG|---========------
`----------FUNCTIONS---------
function Create_Main_Paddles(image1,image2)
ink rgb(255,10,0),0
box 10,10,20,80
get image image1,10,10,20,70
cls
ink rgb(10,255,0),0
box 10,10,20,80
get image image2,10,10,20,70
cls
endfunction
function Ball_generate(image3,radius)
ink rgb(10,0,255),0
sync on:sync rate 0
radius#=radius
oldradius#=radius
while radius#>0
dec radius#,1
circle 320,240,radius#
sync
endwhile
get image image3,300,200,340,280
cls
endfunction
function Generate_Pong_Image
sync on:sync rate 0
y=0
sync
for row=0 to 8
inc y,8
x=0
for col=0 to 16
sync
ink rgb(0,255,0),0
inc x,6
read somedata
if somedata=1
box x,y,x+4,y+4
endif
sync
next col
sync
next row
data 0,0,1,1,0,0,0,0,0,0,0,0,0,0,0,0,0
data 0,0,1,0,1,0,0,0,0,0,0,0,0,0,0,0,0
data 0,0,1,1,0,1,1,1,0,1,1,1,0,1,1,1,0
data 0,0,1,0,0,1,0,1,0,1,0,1,0,1,0,1,0
data 0,0,1,0,0,1,1,1,0,1,0,1,0,1,1,1,0
data 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,0
data 0,0,0,0,0,0,0,0,0,1,1,0,0,0,0,1,0
data 0,0,0,0,0,0,0,0,0,1,1,1,1,1,1,1,0
get image 4,0,0,200,70
cls
sync rate 30
ink rgb(255,255,255),0
endfunction
function create_mouse(radius)
ink rgb(100,g,100),0
while radius>0
ink rgb(100,gre,100),0
dec gre,10
dec radius,1
circle 320,240,radius
sync
endwhile
get image 5,300,200,340,260
endfunction
function generate_menu_sprites
ink rgb(100,200,50),0
text 0,0,"Play"
get image 7,0,0,50,50
cls
ink rgb(20,100,200),0
text 0,0,"Instructions"
get image 8,0,0,100,50
cls
ink rgb(255,20,20),0
text 0,0,"Options"
get image 9,0,0,80,50
cls
endfunction
`GAME ENDING VARIABLES
pwin:
if sound=0 and music=0 then play sound 2
hide sprite 4:hide sprite 1:hide sprite 2:hide sprite 3
repeat
cls rgb(0,255,0):ink rgb(0,255,0),0:wait 100
center text 320,240,"You beat the CPU!"
cls rgb(0,0,0):ink rgb(0,0,0),0:wait 100
center text 320,240,"You beat the CPU!"
ten=ten+1
if sound=0 and music=0 then play sound 2
sync
until ten=10
ink rgb(255,255,255),0
center text 320,240,"You beat the CPU!"
suspend for key
stop sound 2
end
cpuwin:
if sound=0 and music=0 then stop music 3
if sound=0 and music=0 then play music 2
hide sprite 4:hide sprite 1:hide sprite 2:hide sprite 3
cls
center text 320,240,"Failure."
suspend for key
end
`|GAME ENDING VARIABLES|
`MENU
Instructions:
5yy=40
5xx=280
7xx=300
7yy=200
8xx=300
8yy=230
9xx=300
9yy=260
flip sprite 7
mirror sprite 9
bigger=100
smaller#=100
smallval#=.005
do:cls
if smaller#>=1 then dec smaller#,smallval# else exit
if bigger<200 then inc bigger,1
if bigger=200 and 8yy>40 then dec 8yy,1
if bigger=200 and 8yy=40 and 8xx>220 then dec 8xx,1
if music=0 then play music 3
if music_stop=1 then stop music 3
sprite 5,5xx,5yy,4
sprite 6,mousex(),mousey(),5
sprite 7,7xx,7yy,7
sprite 8,8xx,8yy,8
sprite 9,9xx,9yy,9
7xx=7xx+2
if 9xx<0 then 9xx=9xx-1
if 9yy<500 then 9yy=9yy+1
scale sprite 8,bigger
scale sprite 5,smaller#
inc smallval#,.002
sync
loop
sync
cls
print
print
print
print
print
print
print " Use your paddle to Keep the Ball alive.. and get it past your opponent!"
print " Press a Key to Begin."
suspend for key
cls
flip sprite 7
mirror sprite 9
scale sprite 5,100
gosub redo
Options:
sprite_x#=280
huge_=100
do
sprite 5,sprite_x#,40,4
scale sprite 5,huge_
if huge_<500 then inc huge_,1 else exit
dec sprite_x#,.5
sync
loop
hide sprite 7
hide sprite 8
hide sprite 9
cls
ink rgb(255,0,0),0
center text 490,290,"Sound On?"
center text 490,310,"(y)es (n)o"
set text size 80
center text 490,90,"Options"
do
if inkey$()="y" then sound=0:cls:exit
if inkey$()="n"
sound=1:music_stop=1:cls
set text size 10
show sprite 7
show sprite 8
show sprite 9
scale sprite 5,100
return
endif
sync
loop
if music_stop=1 then music_stop=0:play music 3
show sprite 7
show sprite 8
show sprite 9
scale sprite 5,100
set text size 10
return
`|MENU|
end
It looks beautiful if I do say so myself. And yes, the cpu is too slow.
Please Note: When I was working on 6.5 I stripped it of media. So some animations look weird. The media was making it complicated so I rid myself of it.
GLITCH!
After you hit it low, and the "super bounce" happens, you can't make the ball go lower. I'll fix that as soon as I can.
GLITCH!
Mega_curve won't reset itself i.g. you can't use it more then once. (I don't like that)
If someone can fix the mega_curve from not working again, that'd be
really appreciated.
[Another Edit]
Nobody has been posting, or coding for that matter. Is Pong too hard for everyone? Or too easy? Or you don't have time? Or your not interested? It'd be nice to hear from you guys,
Irojo
I urge you to watch the film "Who killed the electric car". Support electric cars! Did you know their used to be more electric cars then gassoline cars?