Compétition PurePunch Juillet-Août 2014

Vous avez développé un logiciel en PureBasic et vous souhaitez le faire connaitre ?
Avatar de l’utilisateur
majikeyric
Messages : 602
Inscription : dim. 08/déc./2013 23:19
Contact :

Re: Compétition PurePunch Juillet-Août 2014

Message par majikeyric »

Non, pour savoir visuellement l'espace inutilisé (en ce qui me concerne).
Avatar de l’utilisateur
graph100
Messages : 1318
Inscription : sam. 21/mai/2005 17:50

Re: Compétition PurePunch Juillet-Août 2014

Message par graph100 »

Effectivement, c'est pratique pour repérer ou sont les espaces libres, ensuite c'est plus joli -> 80 * 50 char.
Et enfin, en période de punch, je désactive la mise en gras des mots clés et j'utilise une police monospace de sorte à avoir tout le code bien aligné :mrgreen:
_________________________________________________
Mon site : CeriseCode (Attention Chantier perpétuel ;))
Avatar de l’utilisateur
SPH
Messages : 4937
Inscription : mer. 09/nov./2005 9:53

Re: Compétition PurePunch Juillet-Août 2014

Message par SPH »

Plus qu'un mois pour proposer le code. Alors, depechez vous 8)

On ne pourrais pas avoir un prévote ? De dire quel code est interessant ?

!i!i!i!i!i!i!i!i!i!
!i!i!i!i!i!i!
!i!i!i!
//// Informations ////
Intel Core i7 4770 64 bits - GTX 650 Ti
Version de PB : 6.12LTS- 64 bits
Avatar de l’utilisateur
Ar-S
Messages : 9539
Inscription : dim. 09/oct./2005 16:51
Contact :

Re: Compétition PurePunch Juillet-Août 2014

Message par Ar-S »

Voilà ma participation, j'en ai chié des ronds de chapeau pour cruncher le tout et atteindre la fatidique limite des 50 lignes.
Et comme le thème est Only 50, mon punch se nomme Only 50's en l'honneur de cette belle époque.

Faire le max de score en cliquant sur la tête de Fonzie ;)
Image : http://pb.ldvmultimedia.com/i.png
Son : http://pb.ldvmultimedia.com/hds2.ogg
Archive complète (code+data+exe) : http://pb.ldvmultimedia.com/PurePunch2014_only_50s.zip

Code : Tout sélectionner

;*****************************************************************************
;*
;* July-August 2014 PurePunch contest
;* PureBasic 5.20 / 5.30
;* 50 lines of 80 chars, 2 months delay
;*
;* Name     :  Happy Days ! Only 50's
;* Author   :	Ar-S
;* Date     :	July 2014
;* Notes    :	Esc to quite - Difficulty : 33 easy - 45 normal - 78 hard - Hits fonzie Face to increase score :)
;*
;*****************************************************************************
Declare h():Macro M:Macro:EndMacro:M _EM:End:End#M:InitMouse()
M dts(id,x,y,c):DisplayTransparentSprite(id,x,y,c):_EM#M:M _P:Procedure:_EM#M
M ds(id,x,y):DisplaySprite(id,x,y):_EM#M:M G(a,b,c):For a=b To c:_EM#M
M GP:GetSoundPosition(4,1):_EM#M:M _SF(a,b):SetSoundFrequency(a,b):_EM#M
M E(id,x,y,w,z):ClipSprite(id,x,y,w,z):_EM#M:M A:And:_EM#M:M C:Case:_EM#M
M R:Random:_EM#M:M AWT:AddWindowTimer:_EM#M:M _Ei:EndIf:_EM#M:M _S:Select:_EM#M
M _Ef:ElseIf:_EM#M:M _EP:EndProcedure:_EM#M:M _ES:EndSelect:_EM#M:InitSound()
M _SD(a):StartDrawing(SpriteOutput(a)):Box(0,0,90,20,$0):_EM#M:InitSprite()
M _DT:DrawText(5,2,"Score : " + Str(sc), $FFFFFF ):StopDrawing():_EM#M
InitKeyboard():UseOGGSoundDecoder():UsePNGImageDecoder():Global TM,s,sp,l,v
Global deg.f,sf,Xd,Xo,Xof,Yd,Yo,Yof,MBx,MinX,MinY,Fy,SS,O,U:U=R(770,62):O=-65
v=5:MaxX=830:MaxY=590:MinX=-40:MinY=-40:Fy=600:SS=-1:_P Ip(f)
Shared Xd,Xo,Xof,Yd,Yo,Yof:_S f:C 1:Xd=211:Yd=222:C 2:Xo=555:Yo=265:C 3:Xd=211
Yd=222:Xo=555:Yo=265:Xof=635:Yof=380:_ES:_Ep:_P mo(f):Static qq.i:If f:Repeat
If ExamineMouse():Mx=MouseX():My=MouseY():_Ei:Delay(1):Until q:q=0:Else
If Not f:q=1:While q:Delay(1):Wend:_Ei:_Ei:_Ep:_P h():Shared v,sf:Protected x,y
x=MouseX():y=MouseY():If x>690 A x<717 A y>567 A y<593:h=12
_Ef x>722 A x<754 A y>567 A y<593:h=11:_Ef x>754 A x<786 A y>567 A y<593
h=18:_Ef x>20 A x<53 A y>567 A y<593:v=3:sf=33100
_Ef x>52 A x<85 A y>567 A y<593:v=5:sf=44100:_Ef x>85 A x<117 A y>567 A y<593
v=8:sf=78100:_Ef x>U A x<U+62 A y>O A y<O+62:h=500:Else:h=0:_Ei
ProcedureReturn h:_Ep:W=OpenWindow(0,0,0, 800,600,"Only 50's !", 1|2147483648)
Ip(3):OpenWindowedScreen(W,0,0,800,600):CreateThread(@mo(),1):SpriteQuality(1)
LoadSprite(6,"i.png",8):LoadSound(4,"hds2.ogg"):sd=SoundLength(4, 1):D=$FFFFFF
D$="b":G(i,7,19):CopySprite(6,i):Next:CreateSprite(14,80,20):E(6,0,137,376,376)
E(9,1,1,404,134):E(10,410,52,103,152):E(7,407,291,103,222):RotateSprite(7,-45,0)
E(8,407,291,103,222):E(12,481,0,32,26):E(18,449,0,32,26):E(11,417,0,32,26)
E(15,417,26,32,26):E(16,449,26,32,26):E(17,481,26,32,26):AWT(0,1,3000)
E(13,449,204,62,62):AWT(0,2,50):AWT(0,3,1000):Repeat:Repeat:ev=WindowEvent()
_S ev:C 13116:End:C 13110:_S EventTimer():C 1:If l=1:If s=1:Xo-1:_S v:C 5
deg+0.5:C 3:deg+0.3:C 8:deg+0.8:_ES:_Ei:_Ef l=0 Or s<1:Ip(3):D=$FFFFFF:_Ei
C 2:If s=1:D=RGB(R(255,0),R(255,0),R(255,0)):_Ei:C 3:If s=1:MBx=R(MaxX-62,62)
MBy=R(MaxY-92,92):If MBx<240 Or MBx>644 A MBx>0 A MBx<644 A MBy>30 A MBy<540
U=MBx:O=MBy:_Ei:_Ei:_ES:C 13112:_S h():C 12:If s=0 Or s=-1:s=1:sc=0:_Ei:C 18
If s<>0:s=0:StopSound(4):TM=2:_Ei:C 11:If s=1:s=-1:Ip(2):MBx=-100:U=MBx
_Ef s=-1:s=1:_Ei:C 500:sc+1:_ES:sd=SoundLength(4,1):_ES:Until ev=0
ExamineKeyboard():ExamineMouse():FlipBuffers():ClearScreen(D):Ds(12,690,566)
DTS(10,100,Fy,255):Ds(11,717,566):Ds(18,743,566):If s=1:Ds(15,20,566)
Ds(16,52,566):Ds(17,84,566):_Ei:Dts(6,Xd,Yd,255):RotateSprite(6,v,1):_SD(14)
_DT:DS(14,0,0):RnD=R(1,0):Bo=R(v+1,1):_S RnD:C 0:G(i,0,Bo):O-1:U+1:Next i:C 1
G(i,0,Bo):O+1:U-1:Next i:_ES:If s=1:Fy=600:SS=-1:If v=0:v=5:_Ei:sp=GP:_SF(4,sf)
If l=0:PlaySound(4,1):SetSoundPosition(4,1500,1):Ip(2):l+1:Else:ResumeSound(4)
_Ei:If sp>8000:TM=1:_Ei:If TM=1 A sp<1550:TM=2:_Ei:If TM=2:SS=0:s=0:_Ei
RotateSprite(8,deg,0):Dts(8,Xo,Yo,255):If T<50 A D$="b":T+1:Dts(9,240,T,255)
_Ef T=50 Or D$="h":D$="h":T-1:Dts(9,240,T,255):If T=0:D$="b":_Ei:_Ei
DTS(13,U,O,255):_Ef s=0:Ip(3):sp=0:l=0:deg.f=0:D=$FFFFFF:v=0
Dts(7,Xof,Yof,320):Dts(9,240,0,255):O=-100:If SS=0 A TM=2:Fy-3:If Fy<460
Fy=460:SS=1:_Ei:_Ei:sf=44100:sp=GP:If SS=1 A sp>1600:StopSound(4):TM=0:_Ei
_Ef s=-1:Ip(2):Dts(8,Xo,Yo,255):v=0:PauseSound(4):Dts(9,240,T,255):_Ei
Until KeyboardPushed(1):End
Dernière modification par Ar-S le mar. 29/juil./2014 8:44, modifié 2 fois.
~~~~Règles du forum ~~~~
⋅.˳˳.⋅ॱ˙˙ॱ⋅.˳Ar-S ˳.⋅ॱ˙˙ॱ⋅.˳˳.⋅
W11x64 PB 6.x
Section HORS SUJET : ICI
LDV MULTIMEDIA : Dépannage informatique & mes Logiciels PB
UPLOAD D'IMAGES : Uploader des images de vos logiciels
Demivec
Messages : 91
Inscription : sam. 18/sept./2010 18:13

Re: Compétition PurePunch Juillet-Août 2014

Message par Demivec »

@Ar-s: Très bon! :)
Backup
Messages : 14526
Inscription : lun. 26/avr./2004 0:40

Re: Compétition PurePunch Juillet-Août 2014

Message par Backup »

sympath :)

elle etait cool, cette Serie ...

bon faut qu'j'aille dans mon bureau ;)
Avatar de l’utilisateur
majikeyric
Messages : 602
Inscription : dim. 08/déc./2013 23:19
Contact :

Re: Compétition PurePunch Juillet-Août 2014

Message par majikeyric »

Un peu de teasing, j'ai bien avancé sur mon second punch,

si j'arrive au bout, ça va être du TRES TRES lourd :mrgreen: ....

wait and see :D

et en plus on en est qu'à la moitiè de la compet !!!
Avatar de l’utilisateur
majikeyric
Messages : 602
Inscription : dim. 08/déc./2013 23:19
Contact :

Re: Compétition PurePunch Juillet-Août 2014

Message par majikeyric »

Après plusieurs heures à galérer à descendre ce source à 50 lignes.

Voici : PunchAnabalt , mon remake du jeu Canabalt !

Image

source + fichier image + fichier musique ici : http://majikeyric.free.fr/download.php? ... nabalt.zip

l'image n'est pas au format png mais bmp , ça m'a fait gagner l'instruction UsePNGImageDecoder... :lol:

Utilisez CTRL-Droite pour sauter !

Code : Tout sélectionner

;*****************************************************************************
;*
;* July-August 2014 PurePunch contest
;* PureBasic 5.22
;* 50 lines of 80 chars, 2 months delay
;*
;* Name     : PunchAnabalt
;* Author   : Majikeyric
;* Date     : 03/08/2014
;* Notes    : Use CTRL-Right to jump.
;* Credits  :
;*       Graphics ripped from the C64 and the iOS versions of the game
;*       C64 SID Music by Mikkel Hastrup (a.k.a Encore)
;*       Level design by Majikeyric
;*
;*****************************************************************************
Macro M:Macro:EndMacro:M E:End:EndMacro:M S:Sprite:EndMacro:M P:Procedure;;;;;;;
EndMacro:M WH:While:EndMacro:M Ini:vx.f=2.0:ax.f=0.5:t.f=0.0:gr.f=0.5:px.f=-88;;
ta=1:tp=1:tb=1:tm=10:go=0:sc=0:CE(3):_=xd(Random(7)):JY=0:io=0:WH po(io)\X<_-52;
io+1:W#E:EndMacro:M Pt:Point:E#M:M R:Repeat:E#M:M SC:Screen:E#M:M U:Until:E#M;;;
M WD:Window:E#M:M K:Keyboard:E#M:M KP:K#Pushed:E#M:M SD(a):St#a#Drawing:End#M;;;
M DT:DisplayTransparent#S:End#M:M G:Global:End#M:M Z:Structure:End#M:M EI:EndIf;
EndMacro:M NT:Next:End#M:M Ot:Output:End#M:M FE:ForEach:End#M:M EL:Else:EndMacro
M RT:Return:EndMacro:#L=640:#H=480:#K=#PB_Key_RightControl:#P=#PB_Any:#R=15728;;
Z T:W.i:A.i:E#Z:Z O:X.f:Y.f:C.i:W.i:I.i:t.f:E#Z:G.f _,JY:G JE,JS,JC,JI:G Q=32;;;
G Dim MP(15,512):G Dim SP(46):G Dim TS.T(68):G Dim AN(5,Q):y$="Score:":P MO(a);;
f=0:JC-1:If JC=0:JC=AN(a,0):JS=SP(AN(a,JI)):JI+1:If AN(a,JI)=0:f=1:JI=1:EI:EI;;;
P#RT f:E#P:P CE(s):JE=s:JC=1:JI=1:E#P:P PD(x,y):n=(y+59)/Q-y/Q+1:i=y/Q:j=(x+;;;;
60)/Q:c=1:WH n>0 And c:If TS(MP(i,j))\A&8:c=0:EI:n-1:i+1:W#E:P#RT c:E#P:P DD(dm)
x=_:y=JY:d=0:c=1:WH c And d<dm:If PD(x,y):x+1:d+1:EL:c=0:EI:W#E:P#RT d:E#P;;;;;;
P PB(x,y):n=(x+59)/Q-x/Q+1:i=(y+60)/Q:j=x/Q:c=1:WH n>0 And c:If TS(MP(i,j))\A&2;
c=0:EI:n-1:j+1:W#E:P#RT c:E#P:P DB(dm):x=_:y=JY:d=0:c=1:WH c And d<dm:If PB(x,y)
y+1:d+1:EL:c=0:EI:W#E:P#RT d:E#P:P PH(x,y):n=(x+59)/Q-x/Q+1:i=(y-1)/Q:j=x/Q:c=1;
WH n>0 And c:If TS(MP(i,j))\A&1:c=0:EI:n-1:j+1:W#E:P#RT c:E#P:P DH(dm):x=_:y=JY;
d=0:c=1:WH c And d>dm:If PH(x,y):y-1:d-1:EL:c=0:EI:W#E:P#RT d:E#P:Dim xd(68);;;;
Dim po.O(16):NewList o.O():UseOGGSoundDecoder():Init#K():InitSound():Init#S();;;
Open#WD(0,0,0,#L,#H,"",#PB_Window_ScreenCentered):Open#WD#ed#SC(WD#ID(0),0,0,#L,
#H):LoadSound(0,"a.ogg"):LoadImage(0,"a.bmp"):Transparent#S#Color(#PB_Default,;;
$ff00ff):SD(art)(Image#Ot(0)):For i=0 To 14:For j=0 To 511:MP(i,j)=Pt(j,i+497);;
NT:NT:For i=0 To 4:For j=0 To 31:AN(i,j)=Pt(j,i+481):NT:NT:For i=0 To 15;;;;;;;;
po(i)\X=Pt(i,486):po(i)\Y=Pt(i,487):po(i)\W=Pt(i,488):NT:SD(op)();;;;;;;;;;;;;;;
SD(art)(SC#Ot()):DrawImage(ImageID(0),0,0):SD(op)():i=0:R:SD(art)(Image#Ot(0));;
x=Pt(i,490):y=Pt(i,491):l=Pt(i,492):h=Pt(i,493):zl=Pt(i,494):zh=Pt(i,495);;;;;;;
SD(op)():SP(i)=Grab#S(#P,x,y,l,h,#PB_#S#_PixelCollision):Zoom#S(SP(i),zl,zh):i+1
U i=46:i=0:j=0:h=0:R:SD(art)(Image#Ot(0)):TS(i)\A=Pt(i,496):xd(i)=Pt(i,489);;;;;
SD(op)():TS(i)\W=Grab#S(#P,j*Q,h*Q,Q,Q):i+1:j+1:If j=16:j=0:h+1:EI:U i=68;;;;;;;
Clear#SC(0):PlaySound(0,#PB_Sound_Loop):Ini:R:R:U WD#Event()=0:Examine#K();;;;;;
If Not go:tp-1:If tp=0:tp=450:px=800:EI:tb-1:If tb=0:tb=1000:av=2000:EI:tm-1;;;;
If tm=0:tm=10:sc+1:EI:ta-1:If ta=0:ta=25:If vx<20:vx+ax:EI:EI:d=DD(vx):If d<>vx;
vx=d:EI:Select JE:Case 0,1:d=DB(1):If d=1:CE(3):t=0:ElseIf KP(#K):CE(2):t=-10:EI
If JE=1:If MO(4):CE(0):EI:EL:If vx>10:MO(1):EL:MO(0):EI:EI:Case 2;;;;;;;;;;;;;;;
If K#Released(#K) And t<-4:t=-4:EI:t+gr:If t<0:d=DH(t):If d<>t:CE(3):EI:JY+d:EL;
CE(3):JY+t:EI:MO(2):Case 3:t+gr:d=DB(t):If d<>t:If t>10:CE(1):EL:CE(0):EI:EI:JY+
d:MO(3):E#Select:FE o():If Not o()\C:If S#PixelCollision(JS,_+vx,JY,o()\W,o()\X,
o()\Y):o()\C=1:CE(1):vx-3:If vx<1:vx=1:EI:EI:EL:o()\I=Random(255):o()\t+gr;;;;;;
o()\Y+o()\t:EI:NT:_+vx:If _>=#R:_-#R:EI:If av>-2000:dy=Random(24)-12:Clear#SC(0)
EL:dy=0:EI:EI:Display#S(SP(0),0,dy):If Not go:If av>-2000:If av>-284 And av<#L;;
DT(SP(40),av,60):EI:av-20:EI:EI:ox=_-16:x=ox/Q:dx=ox%Q:For i=0 To 14;;;;;;;;;;;;
For j=0 To 20:b=MP(i,x+j):If b:DT(TS(b)\W,j*Q-dx,i*Q+dy):EI:NT:NT:If Not go;;;;;
FE o():If o()\X<ox-36 Or o()\X>ox+#L Or o()\Y>#H:DeleteElement(o()):EL:DT(o()\W,
o()\X-ox,o()\Y+dy,o()\I):EI:NT:DT(JS,_-ox,JY+dy):If px>-88:If px<#L:DT(SP(1),px,
dy):EI:px-vx*2:EI:SD(art)(SC#Ot()):t$=Str(sc)+"m":DrawText(#L-TextWidth(t$),0,;;
t$):SD(op)():If JY>419:go=1:EI:WH po(io)\X>ox-36 And po(io)\X<ox+#L;;;;;;;;;;;;;
AddElement(o()):o()\X=po(io)\X:o()\Y=po(io)\Y:o()\W=SP(po(io)\W):o()\C=0:o()\t=0
o()\I=255:io+1:io%16:W#E:EL:DT(SP(45),125,175):SD(art)(SC#Ot()):DrawText(294,;;;
235,y$+sc):SD(op)():If KP(#K):Ini:EI:EI:FlipBuffers():U KP(#PB_Key_Escape);;;;;;

Dernière modification par majikeyric le dim. 17/août/2014 17:13, modifié 3 fois.
Backup
Messages : 14526
Inscription : lun. 26/avr./2004 0:40

Re: Compétition PurePunch Juillet-Août 2014

Message par Backup »

Excellent ! 8O :)
G-Rom
Messages : 3641
Inscription : dim. 10/janv./2010 5:29

Re: Compétition PurePunch Juillet-Août 2014

Message par G-Rom »

Chapeau , super remake ! :D
Avatar de l’utilisateur
SPH
Messages : 4937
Inscription : mer. 09/nov./2005 9:53

Re: Compétition PurePunch Juillet-Août 2014

Message par SPH »

Bravo, tu es dans les 3 premiers !! 8) 8O

!i!i!i!i!i!i!i!i!i!
!i!i!i!i!i!i!
!i!i!i!
//// Informations ////
Intel Core i7 4770 64 bits - GTX 650 Ti
Version de PB : 6.12LTS- 64 bits
Avatar de l’utilisateur
majikeyric
Messages : 602
Inscription : dim. 08/déc./2013 23:19
Contact :

Re: Compétition PurePunch Juillet-Août 2014

Message par majikeyric »

Merci à vous :) J'ai bossé dessus comme un fou depuis quelques jours.
Avatar de l’utilisateur
SPH
Messages : 4937
Inscription : mer. 09/nov./2005 9:53

Re: Compétition PurePunch Juillet-Août 2014

Message par SPH »

Ma production sortira 1 ou 2 jours avant le moment fatidique car j'ai innové et ne veux pas qu'"on me copie.

!i!i!i!i!i!i!i!i!i!
!i!i!i!i!i!i!
!i!i!i!
//// Informations ////
Intel Core i7 4770 64 bits - GTX 650 Ti
Version de PB : 6.12LTS- 64 bits
Avatar de l’utilisateur
majikeyric
Messages : 602
Inscription : dim. 08/déc./2013 23:19
Contact :

Re: Compétition PurePunch Juillet-Août 2014

Message par majikeyric »

SPH a écrit :Ma production sortira 1 ou 2 jours avant le moment fatidique car j'ai innové et ne veux pas qu'"on me copie.
suspense suspense... :mrgreen:

Bon, va falloir que je me lance dans un autre punch alors :)

En cherchant à gagner de la place, j'ai vu un truc marrant, on peut appeler une variable simplement : _ (le caractère underscore) ?!!
Avatar de l’utilisateur
TazNormand
Messages : 1297
Inscription : ven. 27/oct./2006 12:19
Localisation : Calvados (14)

Re: Compétition PurePunch Juillet-Août 2014

Message par TazNormand »

Superbe Majikeyric !!!
Image
Image
Répondre