Autor Beitrag
DeltaEx
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starontopic star
Beiträge: 110



BeitragVerfasst: Mi 02.10.02 23:45 
hi,
Wie scrolle ich in DelphiX denn Hintergrund wie bei Moorhuhn??
kennt einer ein Tutorial oder ein Beispiel bitte posten

_________________
Delphi forever
fcg
ontopic starontopic starontopic starontopic starontopic starontopic starofftopic starofftopic star
Beiträge: 360

WinXP
D3 Prof, D6 Pers
BeitragVerfasst: Do 03.10.02 10:55 
frag die maus / cursor koordinaten ab (ob die maus sich gerade im bildschirmrand befindet) und bewegt danach deine bg sprite. (mit x+ oder -)
DeltaEx Threadstarter
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starontopic star
Beiträge: 110



BeitragVerfasst: Do 03.10.02 21:45 
kann mit der antwort nix anfangen:-(

_________________
Delphi forever
DeCodeGuru
ontopic starontopic starontopic starontopic starontopic starhalf ontopic starofftopic starofftopic star
Beiträge: 1333
Erhaltene Danke: 1

Arch Linux
Eclipse
BeitragVerfasst: Do 03.10.02 22:18 
Zitat:
kann mit der antwort nix anfangen:-(


Pass auf: fcg meint, dass du einfach beim MouseMove-Event überprüfst, ob die Cursorposition nahe beim Bildschirmrand ist. Wenn die Cursorposition beispielweise 10 Pixel nahe am Rand ist, änderst du einfach die X- und Y-Koordinate deiner Sprite.

Ich hoffe, ich konnte dir das ein bisschen Verdeutlichen. Wenn nicht, frag einfach nochmal :wink:

_________________
Viele Grüße
Jakob
DeltaEx Threadstarter
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starontopic star
Beiträge: 110



BeitragVerfasst: Fr 04.10.02 14:50 
könnt ihr mir ein code beispiel geben??

procedure TForm1.DXDraw1MouseMove(Sender: TObject; Shift: TShiftState; X,
Y: Integer);
begin
//Was soll ich da reinschreiben??
end;

_________________
Delphi forever
fcg
ontopic starontopic starontopic starontopic starontopic starontopic starofftopic starofftopic star
Beiträge: 360

WinXP
D3 Prof, D6 Pers
BeitragVerfasst: Fr 04.10.02 15:30 
ausblenden Quelltext
1:
2:
3:
4:
5:
6:
7:
if mouse.cursorpos.X > (screen.width-10) then
hintergrund.x:=hintergrund.x-10; //rechts

//und das ganz auch für die andere Seite mit

if mouse.cursor.pos.X < 10 then
hintergrund.X:=hintergrund.X+10; //links


verstanden :D
hintergrund ist deine hintegrund sprite!
DeltaEx Threadstarter
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starontopic star
Beiträge: 110



BeitragVerfasst: Fr 04.10.02 15:48 
sorry das ich nerve aber ich kapier es nicht wo haste die hintergrund.X her??

unit Unit1;

interface

uses
Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
Dialogs, DXDraws, DXClass, JPEG, DXSprite;

type
TForm1 = class(TForm)
DXDraw1: TDXDraw;
imagelist: TDXImageList;
DXTimer1: TDXTimer;
DXSpriteEngine1: TDXSpriteEngine;
procedure DXTimer1Activate(Sender: TObject);
procedure DXDraw1MouseMove(Sender: TObject; Shift: TShiftState; X,
Y: Integer);
procedure FormCreate(Sender: TObject);
private
{ Private-Deklarationen }
public

{ Public-Deklarationen }
end;

var
Form1: TForm1;
xrechts: integer;
xlinks: integer;

implementation

{$R *.dfm}

procedure TForm1.DXTimer1Activate(Sender: TObject);
begin
DXDraw1.Surface.Fill(0);
imagelist.Items[0].Draw(DXDraw1.Surface,0,0,0);
imagelist.Items[0].StretchDraw(DXDraw1.Surface,rect(xlinks,0,2044,DXDraw1.Height),0);
DXDraw1.Flip;
end;

procedure TForm1.DXDraw1MouseMove(Sender: TObject; Shift: TShiftState; X,
Y: Integer);
begin
if mouse.CursorPos.X > (DXDraw1.Width - 10) then
xlinks:=xlinks- 10;


end;

procedure TForm1.FormCreate(Sender: TObject);
begin
xrechts:=0;
xlinks:=0;
end;

end.

das funkt nicht:-(

_________________
Delphi forever
fcg
ontopic starontopic starontopic starontopic starontopic starontopic starofftopic starofftopic star
Beiträge: 360

WinXP
D3 Prof, D6 Pers
BeitragVerfasst: Fr 04.10.02 16:16 
hintegrund war nun nen beispielname 8)

versuch mal dein onactivate code in die ontimer prozedur reinzuschreiben, sonst hier mein code (mit spriteengine):

ausblenden volle Höhe Quelltext
1:
2:
3:
4:
5:
6:
7:
8:
9:
10:
11:
12:
13:
14:
15:
16:
17:
18:
19:
20:
21:
22:
23:
24:
25:
26:
27:
28:
29:
30:
31:
32:
33:
34:
35:
36:
37:
38:
39:
40:
41:
42:
43:
44:
45:
46:
47:
48:
49:
50:
51:
52:
53:
54:
55:
56:
57:
58:
59:
60:
61:
62:
63:
unit sprint;

interface

uses
  Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
  Dialogs, DXClass, DXInput, DXSprite, DXDraws;

type
  TForm1 = class(TForm)
    DXDraw1: TDXDraw;
    DXImageList1: TDXImageList;
    DXSpriteEngine1: TDXSpriteEngine;
    DXTimer1: TDXTimer;
    procedure onTimer(Sender: TObject; LagCount: Integer);
    procedure FormCreate(Sender: TObject);
  private
    { Private declarations }
  public
    { Public declarations }
  end;

var
  Form1: TForm1;

type
 bg = class (TimageSprite)
 public
  procedure domove (movecount:integer);
 end;

implementation

{$R *.dfm}


procedure bg.domove (movecount:integer);
begin
 inherited domove (movecount);
 if mouse.cursorpos.X > (screen.width-10) then
 x:=x-10;
 if mouse.cursorpos.X < 10 then
 x:=x+10;
end;


procedure TForm1.FormCreate(Sender: TObject);
begin
 with bg.create (Form1.DXSpriteengine1.engine) do
 begin
 x:=0;y:=0;
 end;
end;

procedure TForm1.onTimer(Sender: TObject; LagCount: Integer);
begin
 DXDraw1.Surface.Fill(0);
 DXSpriteengine1.move (1);
 DXSpriteEngine1.Draw;
 DXDraw1.flip;
end;

end.
DeltaEx Threadstarter
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starontopic star
Beiträge: 110



BeitragVerfasst: Fr 04.10.02 16:37 
fcg kannst du mir ein quellcode schicken wo das 100% funkt??
hier kapiere ich nicht wo er das Bild herbekommt

schick mal an DeltaEx@uni.de du würdest mir sehr helfen

_________________
Delphi forever
DeltaEx Threadstarter
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starontopic star
Beiträge: 110



BeitragVerfasst: Fr 04.10.02 19:25 
@fcg, soweit so gut aber ich kriege diese Fehlermeldung:

user defined image

_________________
Delphi forever
fcg
ontopic starontopic starontopic starontopic starontopic starontopic starofftopic starofftopic star
Beiträge: 360

WinXP
D3 Prof, D6 Pers
BeitragVerfasst: Fr 04.10.02 22:36 
spriteengine auf's formular gepackt?

dann versuch mla den constructor veg zu lassen und schreib diese in die formcreate prozedur rein. (lösch das andere vorher)

ausblenden Quelltext
1:
2:
3:
4:
5:
6:
bg := Tbg.Create(DXSpriteEngine1.Engine);
 bg.Image := Form1.DXImageList1.Items.Find('bg');
 bg := DXDraw1.Width div 2;
 bg := 380;
 bg.width := 28;
 bg.height := bg.Image.Height;