Results 1 to 10 of 10

Thread: Access Violation with sprite engine in 1.07

  1. #1

    Access Violation with sprite engine in 1.07

    I am getting access violations (Eaccessviolation):

    when using

    Code:
    Mainfm.dxspriteengine1.Engine.Clear;
    TBall1Sprite.create(Mainfm.dxspriteengine1.engine);
    Where clear supposedly kills off all sprites. It happens much more frequently if there is a scrolling background to be killed then recreated (perhaps because for me that means an extra 3 sprites).

    Any ideas what is wrong? It doesnt do it each time. Seems to be pick and choose when it does it but it is always at this point wheer it fails.

    The cpu window shows it is always hanging 00489060 Tsprite.getcount

    [/code]

  2. #2

    Access Violation with sprite engine in 1.07

    You should use breakpoints to find out where it goes wrong.

    My guess is, that something is destroyed when you call SpriteEngine.Clear, and the Constructor of TBallsprite assumes that object to exist.

    Set some breakpoints in the constructor of TBallSprite. You could also add some breakpoints to the TSprite or TImageSprite constructors. I'm sure you will find the bug.

    Good luck!
    Coders rule nr 1: Face ur bugz.. dont cage them with code, kill'em with ur cursor.

  3. #3

    Access Violation with sprite engine in 1.07

    To kill all sprites try something like:

    DXSpriteEngine.Engine.AllDead;
    DXSpriteEngine.Dead.

    That should work fine. I have never used the Clear function.

    Hope this helps
    <center>
    <br />Federico &quot;FNX&quot; Nisoli
    <br />Lead Programmer - FNX Games
    <br />http://www.fnxgames.com
    <br /><img src="http://www.fnxgames.com/imgs/banners/fnxban.gif">
    <br /></center>

  4. #4

    Access Violation with sprite engine in 1.07

    THANKYOU. I shall test that right away.

    In that case anyone know what is the difference with clear? hmm

    and alldead doesnt seem to exist?
    Code:
    mainfm.DXSpriteEngine1.Engine.Items&#91;0&#93;.dead;
    mainfm.DXSpriteEngine1.Engine.Items&#91;1&#93;.dead;
    mainfm.DXSpriteEngine1.Engine.Items&#91;2&#93;.dead;
    mainfm.DXSpriteEngine1.Engine.Items&#91;3&#93;.dead;
    mainfm.DXSpriteEngine1.Engine.Items&#91;4&#93;.dead;
    mainfm.DXSpriteEngine1.Engine.Items&#91;5&#93;.dead;
    mainfm.DXSpriteEngine1.Engine.Items&#91;6&#93;.dead;
    which I have modified to

    Code:
    For  I&#58;=0 to  mainfm.DXSpriteEngine1.Engine.allcount-1 do
    begin
    mainfm.DXSpriteEngine1.Engine.Items&#91;i&#93;.dead;
    end;
    I have found the above does a pretty good job. Just testing. But wheer did you get alldead from?

  5. #5

    Access Violation with sprite engine in 1.07

    I am thinking this is a bug in undelphix/delphix with clear not getting the number of sprites correctly, since it hangs at getcount.

  6. #6

    Access Violation with sprite engine in 1.07

    and alldead doesnt seem to exist?
    Well i wrote it by memory so it could be Engine.Items.Alldead or
    something like that, just search on Engine and SpriteEngine methods,
    i'm sure it's there
    <center>
    <br />Federico &quot;FNX&quot; Nisoli
    <br />Lead Programmer - FNX Games
    <br />http://www.fnxgames.com
    <br /><img src="http://www.fnxgames.com/imgs/banners/fnxban.gif">
    <br /></center>

  7. #7

    Access Violation with sprite engine in 1.07

    I have had a look, can't seem to find anything like that anywhere?

  8. #8

    Access Violation with sprite engine in 1.07

    jaro is looking into clear bug

  9. #9

    Access Violation with sprite engine in 1.07

    Dead for freeing all unused sprite from memory cannot be use for static sprite. Static spite must be clonned and after them can be Dead.
    Ijcro.

  10. #10

    Access Violation with sprite engine in 1.07

    The "Dead" engine is used for a simple motive... you can't free the sprites while a .move(), .collision() or .draw() is running, you can set it do deaded, will be ignored in these loops, and when you call Engine.Dead after all work is done, all "deaded" sprites are freeing then.

    This is my procedure on timer that i use almost all the time (i use a class to manage "game states" using only the sprite engine to render all)

    // In
    Input.Update;
    SpriteEngine.Move(1);
    States.DoRun;
    // Out
    If Screen.CanDraw Then Begin
    SpriteEngine.Draw;
    Screen.Flip;
    End;
    // Garbage
    SpriteEngine.Dead;

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •