×

Discussion Board

Results 1 to 4 of 4
  1. #1
    Registered User
    Join Date
    May 2006
    Posts
    2

    Question Regarding Sprite

    Hi, am new to J2me thus can you plz help me wiht this
    I have two Sprites ... i need to free move Sprite1 using the key events where as Sprite 2 is required to move automatically after 10 seconds...

    i can't put in a delay as that would stop the application from running

    any suggestions ?

    thanx

    Atiq

  2. #2
    Super Contributor
    Join Date
    Mar 2006
    Posts
    516

    Re: Question Regarding Sprite

    Hi,

    Whycan't u use a timer to move the sprite automatically after 10 seconds.
    http://today.java.net/pub/a/today/20...html?page=last

    Hope this is also helpful
    http://www.gamedev.net/community/for...age=1&#2527688

    Wang

  3. #3
    Registered User
    Join Date
    May 2006
    Posts
    2

    Re: Question Regarding Sprite

    thanx for the links... i think using using seperate threads for my two sprites would solve the problem..that's what i think

    any suggestions :)

  4. #4
    Nokia Developer Champion
    Join Date
    Feb 2006
    Location
    Santiago, Chile
    Posts
    83

    Re: Question Regarding Sprite

    Hi,
    keep in mind that you need a separate thread for the game loop (that's where you put all the logic of your game).
    That's needed because you can't do much work in one of the functions that are called by the OS. For example, you catch all the keyboards events in KeyPressed() right? Well, if you put all your logic in there, then the OS won't get control again, and it won't be able to notify you of the next key pressed. That's a common flaw in some games, you pressed a lot of keys very fast and the games gets unresponsive.
    Back to your problem, that's why you need a separate thread to put that 10 secs delay. But it would be best if check in your gameloop the time that has passed (with System.currenttimemilis).
    Try to look into one of the games samples, all the them use a separate gameloop thread.

    Hope it helps,
    Alejandro W.

Similar Threads

  1. Sprite GameCharacter Movement & Sprite Deletion
    By bloodyknight in forum Mobile Java General
    Replies: 2
    Last Post: 2004-07-10, 02:34
  2. Fast Sprite Effects on Series 40/30
    By leissler in forum Mobile Java Media (Graphics & Sounds)
    Replies: 0
    Last Post: 2003-09-29, 10:10
  3. My Questions are not getting answered
    By earamsey in forum Symbian
    Replies: 1
    Last Post: 2003-06-04, 17:26
  4. Severe RResourceFile Error, HELP!
    By earamsey in forum Symbian
    Replies: 0
    Last Post: 2003-06-02, 19:34
  5. Sending data using iAcceptedSocket (Urgent question)
    By okegame in forum Bluetooth Technology
    Replies: 1
    Last Post: 1970-01-01, 02:00

Posting Permissions

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