Annonces Google
Serveur IRC
Serveur : irc.portlane.se
Canal : #AmigaNG
Activité du Site

Pages vues depuis 25/07/2007 : 25 250 378

  • Nb. de membres 187
  • Nb. d'articles 1 270
  • Nb. de forums 19
  • Nb. de sujets 20
  • Nb. de critiques 24

Top 10  Statistiques

Index du forum »»  Création-Développement »» Outrun Holly démo ;-)

Outrun Holly démo ;-)#1008

8Contributeur(s)
artblinkCreolsElwoodLucaricossasinisrusCrisotLioDavidMiga
3 Modérateur(s)
K-LElwoodcorto
DavidMiga DavidMigaicon_post
Tiens, je te mets le code d'un programme en blitzbasic, affichant une route et un véhicule, je l'avais modifié et je ne l'ai jamais terminé. Si ça peut te servir, meme si c'est pour un 1200.


NEWTYPE .road
    x0.w:z0:y0:x1:z1:y1 ;coordonnees
    col                 ;couleur
    sign                ;largeur
    signx               ;objets
End NEWTYPE

NEWTYPE .draw
    x0.w:y0:x1:y1:x2:y2:x3:y3:x4:y4
End NEWTYPE

NEWTYPE.cmove
    lngth.w   ;longueur en z
    xadd      ;ajout pour des courbes en x
    xch       ;ajout a xadd pour creer des courbes
    yadd      ;ajout en y pour changer de hauteur
End NEWTYPE

DEFTYPE.draw a

Dim obj.road(10),vitesses.w(5)
Dim conflict.cmove(100)

;         x   z    y   x   z   y   c
obj(0)\x0=100,1000,100,100,900,100,1
obj(1)\x0=100,900,100,100,800,100,2
obj(2)\x0=100,800,100,100,700,100,1
obj(3)\x0=100,700,100,100,600,100,2
obj(4)\x0=100,600,100,100,500,100,1
obj(5)\x0=100,500,100,100,400,100,2
obj(6)\x0=100,400,100,100,300,100,1
obj(7)\x0=100,300,100,100,200,100,2
obj(8)\x0=100,200,100,100,100,100,1
obj(9)\x0=100,100,100,100,000,100,2

vitesses(0)=0
vitesses(1)=30
vitesses(2)=45
vitesses(3)=80
vitesses(4)=110
vitesses(5)=160

longueur_circuit=6

conflict(0)\lngth=20,0,3,0
conflict(1)\lngth=20,60,-3,0
conflict(2)\lngth=10,0,-4,8
conflict(3)\lngth=20,-40,1,-8
conflict(4)\lngth=10,-20,2,8
conflict(5)\lngth=100

xview=196 ;position depart
yview=100 ;vue en y
rsize=240 ;largeur route

Function pointx3d{x,z}
    SHARED xview
    xd=160+(x-xview)/(1+(z/200))
    Function Return xd
End Function

Function pointy3d{z,y}
    yd=y/(1+(z/200))
    Function Return yd
End Function

#LARG = 320
#HAUT = 200

BitMap 0,#LARG,#HAUT,4
BitMap 1,#LARG,#HAUT,4
InitCopList 0,44,#HAUT,$10004,0,16,-4

BitMap 2,#LARG,#HAUT,4
LoadBitMap 2,"bak.pic",0
LoadPalette 1,"rbow.col"

LoadShapes 0,35,"test.shp"

BLITZ

DisplayBitMap 0,0
DisplayPalette 0,0
DisplayRainbow 0,8,1
CreateDisplay 0

bm=0:vitesse=0:speed=0:rapport=1
xadd=1:yadd=1
Repeat
  j=Joyr(1)
    ; Deplacement en x
  If vitesse>0
    If j=5 OR j=6 OR j=7
      xview-16
    End If
    If j=1 OR j=2 OR j=3
      xview+16
    End If
    x0=pointx3d{obj(0)\x0,obj(0)\z0}:x1=pointx3d{obj(0)\x0+rsize,obj(0)\z0}
    xx=pointx3d{xview,0}
    If xx<x0-5 Then xview+16
    If xx>x1+5 Then xview-16
;    Line x0,#HAUT-20,x0,#HAUT,1
;    Line x1,#HAUT-20,x1,#HAUT,1
;    Line xx,#HAUT-20,xx,#HAUT,3
  EndIf
    ; Vitesse
  If j=0 OR j=1 OR j=7
    If vitesse<=vitesses(rapport) Then vitesse+2
  Else
    If vitesse>0 Then If j=4 Then vitesse-4 Else vitesse-2
  End If
  If vitesse<0 Then vitesse=0
  speed=vitesse/vitesses(rapport)*100:pourcent=speed/100*30
  Box 4,9,36,21,0:Boxf 5,10,5+pourcent,20,15:If speed>75 Then Boxf 27,10,5+pourcent,20,14
  For i=1 To rapport
    Line 5*i,25,5*i,35,0
  Next
    ; Rapport
  If vitesse>vitesses(rapport) Then rapport+1:If rapport>5 Then rapport=5
  If vitesse<vitesses(rapport-1) Then rapport-1:If rapport<1 Then rapport=1
    ; Avance
  If speed>0
    For nr=0 To 9
      obj(nr)\z0-speed: obj(nr)\z1-speed
    Next
    If obj(9)\z0<-100
        ; Calcul de obj(x)
      rpos+1
      obj(10)\x0=obj(9)\x0
      obj(10)\z0=obj(9)\z0
      obj(10)\x1=obj(9)\x1
      For nr=9 To 1 Step -1
        obj(nr)\x0=obj(nr-1)\x0,obj(nr)\z0+100,obj(nr-1)\y0
        obj(nr)\x1=obj(nr-1)\x1,obj(nr)\z1+100,obj(nr-1)\y1
        obj(nr)\col=obj(nr-1)\col,obj(nr-1)\sign,obj(nr-1)\signx
      Next
        ; Courbes
      If rpos=conflict(conf)\lngth Then rpos=0:conf+1
      If conf=longueur_circuit
        conf=0
        conflict(0)\lngth=20,0,3,0
        conflict(1)\lngth=20,60,-3,0
        conflict(2)\lngth=10,0,-4,8
        conflict(3)\lngth=20,-40,1,-8
        conflict(4)\lngth=10,-20,2,8
        conflict(5)\lngth=100
      Else
        conflict(conf)\xadd+conflict(conf)\xch
      EndIf
      obj(0)\x0=obj(1)\x0+conflict(conf)\xadd
      obj(0)\y0=obj(1)\y0+conflict(conf)\yadd
        ; Initialisation de obj(0)
      obj(0)\z0=1000+obj(10)\z0
      obj(0)\x1=obj(1)\x0,900+obj(10)\z0,obj(1)\y0,3-obj(1)\col
    EndIf
  EndIf
    ; Calcul du point de vue
  k=(obj(8)\y1-obj(8)\y0)/(obj(8)\z1-obj(8)\z0)
  yview=#HAUT-(obj(8)\y0-k*obj(8)\z0)
  If k<0
    car=1
  Else
    If k>0 Then car=2 Else car=0
  End If
  If j=1 OR j=2 OR j=3
    car+3
  Else
    If j=5 OR j=6 OR j=7 Then car+6
  End If
    ; Affichage
  Use BitMap bm
  bm=1-bm
  DisplayBitMap 0,bm
    ; Creation du decor
  BlockScroll 0,0,#LARG,#HAUT,0,0,2
  For nr=0 To 9
    ;x3--x2
    ;x0--x1
    x0=pointx3d{obj(nr)\x0,obj(nr)\z0}:y0=yview+pointy3d{obj(nr)\z0,obj(nr)\y0}
    x1=pointx3d{obj(nr)\x0+rsize,obj(nr)\z0}:y1=y0
    x2=pointx3d{obj(nr)\x1+rsize,obj(nr)\z1}:y2=yview+pointy3d{obj(nr)\z1,obj(nr)\y1}
    x3=pointx3d{obj(nr)\x1,obj(nr)\z1}:y3=y2
    Boxf 0,y0,#LARG-1,#HAUT-1,obj(nr)\col+2
    a\x0=x0,y0,x1,y1,x2,y2,x3,y3,x0,y0
    Polyf 4,a,obj(nr)\col
  Next
    ; Affichage de la voiture
  Blit car,144,168
  VWait
Until Joyb(0)=1

AMIGA

End


DavidMiga

Consoles : Atari 2600 - Amiga CD32
Thomson TO7 - CPC464 - Atari ST1040 - C64+lecteur 5"1/4
A500 - A600 - A2000 - A1200+040/OS3.1 A1200+BPPC040/603+BVision+Mediator avec OS3.9+4.0
Sam 460EX+Radeon HD4650 avec OS4.1FE
Powerbook G4/Morphos
artblink artblinkicon_post
@crisot, c'est vrai qu'holly c'est lent, mais je pense que je suis pas non plus une bête de programmateur ;-) donc je peux améliorer

@davidmiga: merci... intéressant, je vous tiens au courant ;-)

Edit: intéressant, le programme passe par les polygon, donc ils sort directement les point d'intersection... excellent
Message édité par : artblink / 01-03-2011 20:53
Elwood Elwoodicon_post
"programmeur". Un programmateur c'est ça :-)
--
Philippe Ferrucci
Avec une Sam460 et AmigaOS 4.1, je suis eco-responsable. Cool !
artblink artblinkicon_post
Oui, bin la que t'en parle, je suis le premier, celui qui fonctionne avec les cran :-D

Moi je veux avoir le niveau de l'automate ;-)
Petites Annonces

0 annonce(s) publiée(s)

Consulter

AmigaOS 4.1

Laissez-vous tenter par
AmigaOS 4.1
AmiTheme

AmiTheme