Page 1 sur 1

Scrolling centré

Publié : mar. 01/juin/2004 12:40
par YourHead[^_-]
:evil: YoP aLl,
Ben en fait je voudrais réaliser un scrolling a la zelda , ou le personnage est toujours centré dans l'écran seuelemnt , que l'écran le suive je n'arrive qu'a faire juste un scrolling simple donc voila , un petit coup de main serait le bienvenue :P

@+: Thx

Publié : mar. 01/juin/2004 21:34
par comtois
Voila un exemple
Sinon Flype avait fait un super truc aussi , tu trouveras son code sur le musée français . Par contre je n'arrive pas à faire de recherche sur le site , Cederavic c'est normal ?

Code : Tout sélectionner

; German forum: http://robsite.de/php/pureboard/viewtopic.php?t=1212&highlight=
; Author: Danilo
; Date: 02. June 2003


; Example, how the background of a player will be moved, and the player still hold its position
; in the middle of the screen

#SPRITE_W = 50 
#SPRITE_H = 50 

#SCREEN_W = 800 
#SCREEN_H = 600 

If InitSprite() = 0 Or InitKeyboard() = 0 
  MessageRequester("ERROR","Cant init DirectX",0):End 
EndIf 

If OpenScreen(#SCREEN_W,#SCREEN_H,32,"TEST") = 0    ; test 32bit 
  If OpenScreen(#SCREEN_W,#SCREEN_H,24,"TEST") = 0   ; if 32bit failed, test 24bit 
    If OpenScreen(#SCREEN_W,#SCREEN_H,16,"TEST") = 0  ; if 32/24 failed, try 16bit screen 
      MessageRequester("ERROR","Cant open 16/24/32bit Screen",0):End 
    EndIf 
  EndIf 
EndIf 

   ; limit Speed 
SetFrameRate(50) 

CreateSprite(1,#SPRITE_W,#SPRITE_H) 
StartDrawing(SpriteOutput(1)) 
Box(0,0,#SPRITE_W,#SPRITE_H,RGB($00,$00,$FF)) 
StopDrawing() 

CreateSprite(2,#SPRITE_W,#SPRITE_H) 
StartDrawing(SpriteOutput(2)) 
Box(0,0,#SPRITE_W,#SPRITE_H,RGB($FF,$FF,$FF)) 
StopDrawing() 

CreateSprite(3,50,50) 
StartDrawing(SpriteOutput(3)) 
Locate(0,18) 
DrawingMode(1) 
FrontColor($10,$10,$10) 
DrawText("Player1") 
StopDrawing() 

Repeat 
  FlipBuffers() 
  ExamineKeyboard() 
  If IsScreenActive() 
    ;ClearScreen($66,$66,$66) 
    
    ; KEYBOARD CHECK 
    ; 
    If KeyboardPushed(#PB_Key_Up) 
      backY + 2 
    EndIf 
    If KeyboardPushed(#PB_Key_Down) 
      backY - 2 
    EndIf 
    
    If KeyboardPushed(#PB_Key_Right) 
      backX - 2 
    EndIf 
    
    If KeyboardPushed(#PB_Key_Left) 
      backX + 2 
    EndIf 
    
    
    If backY <= ((-(#SPRITE_H*2))-1) : backY + #SPRITE_H*2: EndIf 
    If backY => 1   : backY - (#SPRITE_H*2) : EndIf 
    
    If backX <= ((-(#SPRITE_W*2))-1) : backX + #SPRITE_W*2 : EndIf 
    If backX => 1   : backX - (#SPRITE_W*2) : EndIf 
    
    For a = 0 To (#SCREEN_W/#SPRITE_W)/2 
      For b = 0 To (#SCREEN_H/#SPRITE_H)/2 
        DisplaySprite(1,          backX+a*#SPRITE_W*2,backY+b*#SPRITE_H*2) 
        DisplaySprite(2,#SPRITE_W+backX+a*#SPRITE_W*2,backY+b*#SPRITE_H*2) 
        DisplaySprite(2,          backX+a*#SPRITE_W*2,#SPRITE_H+backY+b*#SPRITE_H*2) 
        DisplaySprite(1,#SPRITE_W+backX+a*#SPRITE_W*2,#SPRITE_H+backY+b*#SPRITE_H*2) 
      Next b 
    Next a 
    ; Player 
    DisplayTransparentSprite(3,#SCREEN_W/2-25,#SCREEN_H/2-25) 
    sleep_(1) 
  Else 
    sleep_(200) 
  EndIf 
Until KeyboardPushed(#PB_Key_Escape) 
End 

; ExecutableFormat=Windows
; EOF

Publié : mar. 01/juin/2004 21:38
par cederavic
chez moi ça marche... voilas la page généré : http://www.serveurperso.com/~cederavic/ ... =scrolling

et la page dont tu parler : http://www.serveurperso.com/~cederavic/ ... cf9016173c

Publié : mar. 01/juin/2004 21:46
par comtois
Dans le champs Recherche par Mots Clés
je tape scrolling et je valide, je ne change aucun paramètre , et voila le résultat :?
Désolé, une erreur s'est produite. Si vous n'êtes pas certain de l'utilisation d'une fonction, ou que vous ne savez pas pourquoi vous obtenez ce message d'erreur, lisez les fichiers d'aide pour de plus amples informations.

L'erreur renvoyée est:

Désolé, mais nous n'avons trouvé aucune correspondance à afficher. Essayez à nouveau en élargissant vos critères de recherche.
Enfin merci pour les liens .

Pas de pot le lien est mort , Flype si tu passes par là .... :P

Publié : mar. 01/juin/2004 21:53
par Chris
il faut modifier dans la liste rechercher depuis les 30 derniers jours. (ou un truc comme çà)

Chris :)

Publié : mar. 01/juin/2004 21:58
par comtois
Merci Chris :)

Je peux t'emprunter ta signature quelques minutes ? :lol:


Cederavic ,c'est possible de changer les paramètres pour que la recherche se fasse "De toutes les dates" ?

Publié : mar. 01/juin/2004 22:23
par Chris
Comtois a écrit :Je peux t'emprunter ta signature quelques minutes ?
C'est toi qui voit :lol:

Chris :)

Publié : mer. 02/juin/2004 8:08
par cederavic
j'avais dejas regarder mais pa trouver, je vais rejeter un oeil...

Publié : mer. 02/juin/2004 8:12
par YourHead[^_-]
8) Thx all :-) :roll: