English
Forum

Mouse and Sprite

 
Hi,
be in between time again on my Game on the basteln.
from Found, The me so rather fallen, change I The Spriterichtung where straight The mouse hinzeigt.
however I will not hinbekommen, a right request to start:
if equ(MouseButton(),1)

    if lt(%mousey,y&)

        SetSpriteAnim (sprite&,0,68,96,67,9,1,7)
        MoveSprite(sprite&,%mousex,%mousey)
        direction%=2

    endif

    if gt(%mousey,y%)

        SetSpriteAnim (sprite&,0,0,96,67,9,1,7)
        MoveSprite(sprite&,%mousex,%mousey)
        direction%=1

    endif

    if lt(%mousex,x&)

        SetSpriteAnim (sprite&,0,270,96,67,9,1,7)
        MoveSprite(sprite&,%mousex,%mousey)
        direction%=3

    endif

    if gt(%mousex,x&)

        SetSpriteAnim (sprite&,0,205,96,67,9,1,7)
        MoveSprite(sprite&,%mousex,%mousey)
        direction%=4

    endif

    while equ(MouseButton(),1)

        x&=GetSpriteX(sprite&)
        y&=GetSpriteY(sprite&)

        if equ(step%,10)

            case equ(sound%,1):Playsound goes$,17
            step%=0

        endif

        inc step%

    wend

    if equ(direction%,1)

        MoveSprite(sprite&,x&,y&)
        SetSpriteAnim (sprite&,0,135,96,67,1,1,1)
        SetSpriteAnimMode (sprite&,1)

    elseif equ(direction%,2)

        MoveSprite(sprite&,x&,y&)
        SetSpriteAnim (sprite&,97,135,96,67,1,1,1)
        SetSpriteAnimMode (sprite&,1)

    elseif equ(direction%,3)

        MoveSprite(sprite&,x&,y&)
        SetSpriteAnim (sprite&,300,135,96,67,1,1,1)
        SetSpriteAnimMode (sprite&,1)

    elseif equ(direction%,4)

        MoveSprite(sprite&,x&,y&)
        SetSpriteAnim (sprite&,200,135,96,67,1,1,1)
        SetSpriteAnimMode (sprite&,1)

    endif

else

    ......

Logischerweise are The Coordinates twice abfragbar.
has of/ one ne idea, How I it hinbekomme, the really only into direction The Animation shows, in which too the Cursor is?
Rolf
 
04/20/04  
 



Achso:
x&=GetSpriteX(sprite&)
y&=GetSpriteY(sprite&)

;) Rolf
 
04/20/04  
 



Hi Rolf,

if itself the Sprite to that Cursor hinbewegt, can you this here use:

GetSpriteMoveXY (H)

testing, in which direction itself the Sprite with the lever H momentarily moving.

H : Long - lever one with InitSprite() begot Sprites

Ergebniss: Long - Bewegungsrichtung the Sprites.

0 = Sprite standing still
1 = movement to right supra
2 = movement to right
3 = movement to right under
4 = movement down
5 = movement to left under
6 = movement to left
7 = movement to left supra
8 = movement to supra

GetSpriteMoveXY(sprite&)

P.s. be straight thereby, ProSpeeds guide To improve, More interne left and short Beispielcodes to the functions...

Greeting, Frank
 
04/20/04  
 



Hi and thanks Frank.
however I get not there ;(((
WHILENOT EQU(%Scankey,27)

    getmessage

    if equ(MouseButton(),1)

        SetSpriteAnim (sprite&,0,68,96,67,9,1,7)
        MoveSprite(sprite&,%mousex,%mousey)

        while equ(MouseButton(),1)

            x&=GetSpriteMoveXY (sprite&)
            locate 1,1
            print x&

            if equ(step%,10)

                case equ(sound%,1):Playsound goes$,17
                step%=0

            endif

            inc step%

            if equ(x&,3)  After UNTEN

                SetSpriteAnim (sprite&,0,135,96,67,1,1,1)
                MoveSprite(sprite&,%mousex,%mousey)
                SetSpriteAnimMode (sprite&,0)
                direction%=1

            elseif equ(x&,4)

                SetSpriteAnim (sprite&,0,135,96,67,1,1,1)
                MoveSprite(sprite&,%mousex,%mousey)
                SetSpriteAnimMode (sprite&,0)
                direction%=1

            elseif equ(x&,5)

                SetSpriteAnim (sprite&,0,135,96,67,1,1,1)
                MoveSprite(sprite&,%mousex,%mousey)
                SetSpriteAnimMode (sprite&,0)
                direction%=1

            elseif equ(x&,4) UNTEN

                SetSpriteAnimMode (sprite&,0)
                SetSpriteAnim (sprite&,97,135,96,67,1,1,1)
                direction%=2

            endif

        wend

        if equ(direction%,1) OBEN

            SetSpriteAnimMode (sprite&,1)
            SetSpriteAnim (sprite&,0,135,96,67,1,1,1)

        elseif equ(direction%,2) UNTEN

            SetSpriteAnimMode (sprite&,1)
            SetSpriteAnim (sprite&,97,135,96,67,1,1,1)

        endif

    else

        ex here now Reaktionen in the game:

    Elseif and(mouse(121,355-140,405),equ(%mousekey,1))     KLICK ON charmer

        TEXT "DEIN FRIEDEN","ER IS ERST DANN FREI","WENN DU SKULOR FINDEST"

    endif

wend


Irgendwas make I wrong, is me clear, only what?
The code means Yes:

as long as left Mouse button:
Look which direction the Sprite and then set new Spritefigur.
however now moving itself the Sprite (each from 9 Images in the row) not any more. it slips (as well as in the Sendung South park ;))) ) without itself To moving to that Endpunkt.
clear - I have here only testweise some directions quizzed.
How would You, the (or who otherwise) make????
knows one Yes from Diablo u.s.w The mouse verwandelt itself then too in a Cursor, which into direction shows.
Puhhh, naja then mach I as long as with ROC moreover )))))
thanks in the Vorraus
Rolf
 
04/20/04  
 



Hello Rolf,

i'm not yet 100%ig clear, what very You make want...
How sees your Sprite because from, a manner arrow ?
and the should into direction show, where itself the Cursor befindet ? or should itself the Sprite too there moving.

be somehow something begriffsstutzig today :-/

Greeting, Frank
 
04/20/04  
 



Hi Frank,
no lying well on of my Statement.

my Sprite is a human.
this human exists from all 8 directions.
In eachone direction are each 9 Einzelbilder.
(Related to the arrow was only so on the Rande)

now I will:
as long as Mouse button left is pressed
then
each discern in which direction It's all right and accordingly in the Whileschleife (means Maus=1)
whom Humans naturally too the Laufrichtung adjust.
however inside the Loop (see code) runs the fellow then not any more, separate remaining always on the first Image stand - it rutsch means without Animation to that Zielpunkt.

Rolf
 
04/20/04  
 



Hi,

I see.

Schreib still time instead of:

if equ(MouseButton(),1)
...

this here:

t&=MouseButton()
If TestBit(t&,0) left Mouse button pressed ?
...

Greeting, Frank
 
04/20/04  
 



Hi I again.
Habs so far hinbekommen.
The inquire haven't ausgereicht. it mussten yet More since.
to that example actually Spriteposition in a Variable secure circa later in the Loop only Änderung To update u.s.w.
nevertheless thanks.
Rolf
 
04/20/04  
 



Hello Rolf.

lovely. If you soon a Tester seek, mach I gladly...

Greeting, Frank
 
04/20/04  
 



Yes gladly Frank,
sees integral rather as my altes Demogame from.
however, naja - Roc has precedence and the Game is ne schleppende thing. If you another year patience have hihihihihi!
Rolf
 
04/20/04  
 



Hi,

Real? One year ?
well Yes, I can Waiting... )

Greeting, Frank
 
04/20/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

3.773 Views

Untitledvor 0 min.
Sven Bader11/16/21
Walter04/07/19
maroro05/25/18
gerd07/30/13
More...

Themeninformationen

this Topic has 1 subscriber:

unbekannt (11x)


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