English
Forum

Sprites keyboard moving

 
i want one Sprite with the Keys moving.
my first attempt is nothing moreover as one gekürztes an example with the bee.
i'm me but quite sure,
that The Keyboard-Query and Movesprite so not combined go.
(Scrolling the Hintergrundes is into Examples Yes lovely declared.)
I have time a attempt without Prospeed written (V 7.0) and there have I simply
only x% increased or. minimizes and then MCop-iert. (see under and behind -----?????).
goes that here about too ?
Perhaps has of/ one already one small Program geschreiben where I blos
abgucken need ?
anyway in the ahead many Thanks and again:
good Slip and a well New year !
Jürgen.
CompileMarkSeparation
------------
Declare HWnd&, Bereich#, Neu&, Background&
Declare fensterkopie1&, fensterkopie2&, spriteplane&
Declare sprite1&, x%, y%, ende%
Dim Bereich#,512
X% = 100
y% = 200
 $I Prospeed_Funktionen.inc
neu&=usedll("ProSpeed.dll")
def getKey(1) !"user32","GetKeyState"
WindowStyle 26
cls
SetTrueColor 1
Hwnd& = %HWnd
string bereich#,0="bmps/Hintergrund.jpg"
background&=LoadExtImage(bereich#)
CopyExtBmp(%HDC, 0,0,800,400,background&,0,0,0)
CopyExtBmp(%HDC2,0,0,800,400,background&,0,0,0)
fensterkopie1&=CreateExtBmp(%HDC,800,400)
fensterkopie2&=CreateExtBmp(%HDC,800,400)
CopyExtBmp(fensterkopie1&,0,0,800,400,%HDC,0,0,0)
CopyExtBmp(fensterkopie2&,0,0,800,400,%HDC,0,0,0)
string bereich#,0="bmps/sprites.gif"
spriteplane&=LoadExtImage(bereich#)
sprite1&=InitSprite(spriteplane&,%HDC,fensterkopie1&,fensterkopie2&,0,0,24,18,4,1,6,x%,y%,1,1)
SetSpriteSpeed (sprite1&,10,0)------????
---------------------------

Whilenot ende%

    waitinput------????
    sleep 10

    IF @equ(%key,2) OR @equ(%key,27)

        ende%=1

    Endif

    If @LT(getkey(49),-126)

        sub x%,2
        MoveSprite(sprite1&,x%,y%)------------????
        Hier stünde:
        Startpaint -1
        MCopyBmp "Sprite nach Fensterkopie", x%, y%
        u. s. w......
        EndPaint

    EndIf

    If @LT(getkey(51),-126)

        add x%,2
        MoveSprite(sprite1&,x%,y%)------------????

    EndIf

    Mcopy "Fensterkopie auf den Bildschirm

wend

Wo würde ich den Sprung in die PROC hinschreiben die y% für einen Sprung errechnet?
=========================
DeleteAllSprites()
FreeExtBmp(background&)
FreeExtBmp(spriteplane&)
FreeExtBmp(fensterkopie1&)
FreeExtBmp(fensterkopie2&)
freedll neu&
../../function-references/XProfan/dispose/'>Dispose area#
 
04/24/04  
 



Hi,

have dus already with ProSpeeds GetSystemKey() probiert ?
MoveSprite() and GetSystemKey() müßten without Problems kombinierbar his...

Yes, ditto all a terrific Slip to 2004 !!!

Greeting, Frank
 
04/24/04  
 



Hi Frank,
GetSytemKey isn't the trouble. (in the Übringen even something slower as getkey(.)).
circa a Jump & Run To write need I your DLL, there tappt im dunkeln The function SetBackAutoCollision contains and particularly a scheduler prepares, The my Figur (over The weißen boxes the Fensterkopie) lead.
but very with this function have I mean Problems:
If I The Figur by MoveSprite through Keys move and SetBackAutoCollision on Kollision set is, hüpft The Figur. lateral can I The Figur then none More moving.
means The Control by Button and SetBackAutoCollision are the eigentliche trouble. Perhaps can You me help, I faith any mutants ausprobiert to have.
(in the Spieleforum GEHTS apparently around the same trouble)
otherwise one healthy new year 2004.
Greeting Jürgen!
 
04/24/04  
 



Hi,

in this drop come You with MoveSprite() not always moreover.
For this, müßtest You SetSpritePos() using.
having yourself yesterday the same trouble and SetSpritePos elegant resolved.

Greeting, Frank
 
04/24/04  
 



Hi Frank
have I indeed already probiert, but SetBackAutoCollision functions then not.
If I do not To very nerve, Perhaps has irgenwer Schonmal one small example program ? or have You Perhaps a statement from Your Program ?
I entschuldige for trouble, The I yet made have and bedanke me for your understanding.
Tschüß Jürgen.
 
04/24/04  
 



Hello Jürgen,

You make no trouble !
For this is this Forum still virtual, circa ask To answer !

I Have your Source something changed.
the Sprite can now with the Cursortasten within bestimmter border (your electoral) gesteuert go. even diagonal !
the whole ought to without Problems with SetBackAutoCollision() kombinierbar his...
for the Tastenabfrage appear me The API GetKeyState() on the idealsten.
WaitInput can you not using, unless, You setting a small Timer. but is indeed none necessary...

here the code:
CompileMarkSeparation
Declare HWnd&, Bereich#, Neu&, Background&
Declare fensterkopie1&, fensterkopie2&, spriteplane&
Declare sprite1&,x&,y&,key&
Declare speedx&,speedy&,randl&,randr&,rando&,randu&
Dim Bereich#,512
SetTrueColor 1
 $I Prospeed_Funktionen.inc
neu&=usedll("ProSpeed.dll")
DEF GetKeyState(1) !"USER32","GetKeyState"
DEF IsKey(1) and(GetKeyState(&(1)),$8000)
WindowStyle 26
Window 0,0-800,400
Hwnd& = %HWnd
Aktuelle Position
x&=100
y&=100
Geschwindigkeit des Sprites
speedx&=2
speedy&=2
Randgrenzen absolut (links, oben, rechts und unten)
randl&=0
rando&=0
randr&=200
randu&=200
string bereich#,0="bmps/Hintergrund.jpg"
background&=LoadExtImage(bereich#)
CopyExtBmp(%HDC, 0,0,800,400,background&,0,0,0)
CopyExtBmp(%HDC2,0,0,800,400,background&,0,0,0)
fensterkopie1&=CreateExtBmp(%HDC,800,400)
fensterkopie2&=CreateExtBmp(%HDC,800,400)
CopyExtBmp(fensterkopie1&,0,0,800,400,%HDC,0,0,0)
CopyExtBmp(fensterkopie2&,0,0,800,400,%HDC,0,0,0)
string bereich#,0="bmps/sprites.gif"
spriteplane&=LoadExtImage(bereich#)
sprite1&=InitSprite(spriteplane&,%HDC,fensterkopie1&,fensterkopie2&,0,0,24,
18,4,1,6,100,100,speedx&,speedy&)

While 1

    Sleep 1
    key&=GetSystemKey()
    Case (key&=2 OR key&=27):BREAK
    Steuern per Cursortasten
    Case IsKey($25):x&=x&-speedx&  links
    Case IsKey($27):x&=x&+speedx&  rechts
    Case IsKey($26):y&=y&-speedy&  oben
    Case IsKey($28):y&=y&+speedy&  unten
    Stößt Sprite an Randgrenze ?
    Case x&<=randl&:x&=randl&
    Case x&>=randr&:x&=randr&
    Case y&<=rando&:y&=rando&
    Case y&>=randu&:y&=randu&
    MoveSprite(sprite1&,x&,y&)

Wend

DeleteAllSprites()
FreeAllExtBmps()
freedll neu&
Dispose area#

Greeting, Frank
 
04/24/04  
 



Hi Frank,
having yet no Time. means many Thanks !!
 
04/24/04  
 



Answer


Topictitle, max. 100 characters.
 

Systemprofile:

no Systemprofil laid out. [anlegen]

XProfan:

 Posting  Font  Smilies  ▼ 

Please register circa a Posting To verfassen.
 

Topic-Options

2.559 Views

Untitledvor 0 min.
macuto11/20/12
Peter Max Müller09/29/12
Gabor Krizsma08/08/11

Themeninformationen

this Topic has 1 subscriber:

unbekannt (7x)


Admins  |  AGB  |  Applications  |  Authors  |  Chat  |  Privacy Policy  |  Download  |  Entrance  |  Help  |  Merchantportal  |  Imprint  |  Mart  |  Interfaces  |  SDK  |  Services  |  Games  |  Search  |  Support

One proposition all XProfan, The there's!


My XProfan
Private Messages
Own Storage Forum
Topics-Remember-List
Own Posts
Own Topics
Clipboard
Log off
 Deutsch English Français Español Italia
Translations

Privacy Policy


we use Cookies only as Session-Cookies because of the technical necessity and with us there no Cookies of Drittanbietern.

If you here on our Website click or navigate, stimmst You ours registration of Information in our Cookies on XProfan.Net To.

further Information To our Cookies and moreover, How You The control above keep, find You in ours nachfolgenden Datenschutzerklärung.


all rightDatenschutzerklärung
i want none Cookie