marche pas!

Vous débutez et vous avez besoin d'aide ? N'hésitez pas à poser vos questions
gadjet35
Messages : 190
Inscription : ven. 21/oct./2005 7:49
Localisation : Quelque part en france !

marche pas!

Message par gadjet35 »

j'ai créer un code qui ne marche pas pourtant il est tellement logique!
j'y comprend rien pourquoi il ne veut pas marcher j'ai créer un sprite (qui marche) et une image (qui ne marche pas) que ce passe t'il?

Code : Tout sélectionner

If InitSprite() = 0 Or InitKeyboard() = 0 Or InitMouse() = 0
 MessageRequester("erreur","vous ne pouvez pas commencer")
EndIf

If ExamineDesktops()
    borx = DesktopWidth(0)
    bory = DesktopHeight(0)
EndIf

test = OpenWindow(0,0,0,borx,bory,0,"test")
 OpenWindowedScreen(test,0,0,borx,bory,0,0,0)
 
  CreateGadgetList(WindowID(0))
   ImageGadget(0,0,0,0,0,image)
  
 image = CreateImage(0,64,64)
    StartDrawing(ImageOutput())
     Circle(250,250,32,RGB(250,0,0))
    StopDrawing()  

 If CreateSprite(0,64,64) 
  StartDrawing(SpriteOutput(0)) 
  Circle(32,32,32,RGB(0,250,0)) 
  StopDrawing() 
 EndIf
 
 
  Repeat
  
   ClearScreen(0,0,0)
    ExamineMouse()
    ExamineKeyboard()
   If KeyboardPushed(#PB_Key_Up)
     y - 1
   EndIf
   
   If KeyboardPushed(#PB_Key_Down)
     y + 1
   EndIf
   
   If KeyboardPushed(#PB_Key_Left)
     x - 1
   EndIf
   
   If KeyboardPushed(#PB_Key_Right)
     x + 1
   EndIf
   
   If KeyboardPushed(#PB_Key_R)
     b - 1
   EndIf
   
   If KeyboardPushed(#PB_Key_F)
     b + 1
   EndIf
   
   If KeyboardPushed(#PB_Key_D)
     a - 1
   EndIf
   
   If KeyboardPushed(#PB_Key_G)
     a + 1
   EndIf
   
    DisplaySprite(0,x,y)
    ResizeGadget(0,a,b,-1,-1)
   
   FlipBuffers() 

    WaitWindowEvent()

 Until KeyboardPushed(#PB_Key_Escape)
Avatar de l’utilisateur
Chris
Messages : 3731
Inscription : sam. 24/janv./2004 14:54
Contact :

Message par Chris »

On ne peux pas afficher des gadgets sur un WindowedScreen()

Ton ImageGadget() ne peut donc pas être affichée.
gadjet35
Messages : 190
Inscription : ven. 21/oct./2005 7:49
Localisation : Quelque part en france !

Message par gadjet35 »

peut être mais j'ai aussi essaiyer avec deux sprite et sa na pas marcher non plus!

Code : Tout sélectionner

If InitSprite() = 0 Or InitKeyboard() = 0 Or InitMouse() = 0
 MessageRequester("erreur","vous ne pouvez pas commencer")
EndIf

If ExamineDesktops()
    borx = DesktopWidth(0)
    bory = DesktopHeight(0)
EndIf

test = OpenWindow(0,0,0,borx,bory,0,"test")
 OpenWindowedScreen(test,0,0,borx,bory,0,0,0)

  If CreateSprite(0,64,64) 
  StartDrawing(SpriteOutput(0)) 
  Circle(32,32,32,RGB(0,250,0)) 
  StopDrawing() 
 EndIf

 If CreateSprite(1,64,64) 
  StartDrawing(SpriteOutput(1)) 
  Circle(100,100,32,RGB(250,0,0)) 
  StopDrawing() 
 EndIf
 
 
  Repeat
  
   ClearScreen(0,0,0)
    ExamineMouse()
    ExamineKeyboard()
   If KeyboardPushed(#PB_Key_Up)
     y - 1
   EndIf
   
   If KeyboardPushed(#PB_Key_Down)
     y + 1
   EndIf
   
   If KeyboardPushed(#PB_Key_Left)
     x - 1
   EndIf
   
   If KeyboardPushed(#PB_Key_Right)
     x + 1
   EndIf
   
   If KeyboardPushed(#PB_Key_R)
     b - 1
   EndIf
   
   If KeyboardPushed(#PB_Key_F)
     b + 1
   EndIf
   
   If KeyboardPushed(#PB_Key_D)
     a - 1
   EndIf
   
   If KeyboardPushed(#PB_Key_G)
     a + 1
   EndIf
   
    DisplaySprite(0,x,y)
    DisplaySprite(1,a,b)
   
   FlipBuffers() 

    WaitWindowEvent()

 Until KeyboardPushed(#PB_Key_Escape)
Avatar de l’utilisateur
Chris
Messages : 3731
Inscription : sam. 24/janv./2004 14:54
Contact :

Message par Chris »

Evidemment, tu crées un sprite de 64x64, et du dessine un cercle aux coordonnées 100x100 !

T'as pas l'impression de dessiner en dehors du sprite ?

Appuye sur la touche --> et tu verras ton sprite 0 sortir de dessous le sprite 1 qui est vide. (et donc, noir)
brossden
Messages : 833
Inscription : lun. 26/janv./2004 14:37

Message par brossden »

Bonjour à tous

essaye çà !

Code : Tout sélectionner

If InitSprite() = 0 Or InitKeyboard() = 0 Or InitMouse() = 0
  MessageRequester("erreur","vous ne pouvez pas commencer")
EndIf
a=100 ;Position initiale du sprite1
b=100 ;     "          "       "     "
p=2 ;Permet d'augmenter le pas donc la vitesse
If ExamineDesktops()
  borx = DesktopWidth(0)
  bory = DesktopHeight(0)
EndIf

test = OpenWindow(0,0,0,borx,bory,0,"test")
OpenWindowedScreen(test,0,0,borx,bory,0,0,0)

If CreateSprite(0,64,64)
  StartDrawing(SpriteOutput(0))
  Circle(32,32,32,RGB(0,250,0))
  
 StopDrawing()
EndIf

If CreateSprite(1,64,64)
  StartDrawing(SpriteOutput(1))
  Circle(32,32,32,RGB(250,0,0))
  StopDrawing()
  DisplaySprite(0,a,b)
EndIf
 
 
Repeat
  
  ClearScreen(0,0,0)
  ExamineMouse()
  ExamineKeyboard()
  
  If KeyboardPushed(#PB_Key_Up)
    y - p
  EndIf
  
  If KeyboardPushed(#PB_Key_Down)
    y + p
  EndIf
  
  If KeyboardPushed(#PB_Key_Left)
    x - p
  EndIf
  
  If KeyboardPushed(#PB_Key_Right)
    x + p
  EndIf
  
  If KeyboardPushed(#PB_Key_R)
    b - p
  EndIf
  
  If KeyboardPushed(#PB_Key_F)
    b + p
  EndIf
  
  If KeyboardPushed(#PB_Key_D)
    a - p
  EndIf
  
  If KeyboardPushed(#PB_Key_G)
    a + p
  EndIf
  
  DisplaySprite(0,x,y)
  DisplaySprite(1,a,b)
  Debug x
  Debug y
  FlipBuffers()
  
  WaitWindowEvent()
  
Until KeyboardPushed(#PB_Key_Escape) 
Denis

Bonne Jounée à tous
Répondre