×

Discussion Board

Results 1 to 5 of 5

Thread: Arkanoid!

  1. #1
    Registered User
    Join Date
    Nov 2003
    Posts
    13

    Arkanoid!

    Just a simple question...

    My project worked fine till i start adding the classes for the Level and Bricks and stuff like that...

    I think it's because Level and Bricks must Extend something...but i don't have sure of what it is...

    is it canvas?? is it a Midlet?? what should i insert?

    Regards
    Luis Simoes

  2. #2
    Super Contributor
    Join Date
    Mar 2003
    Location
    Israel
    Posts
    2,280
    No class must extends another class fro no reason. In fact, every class automatically extends Object unless otherwise stated.
    If you want the class to do something specific then it might have to extend another class. For example if you want to use a class instance as a parameter to Display.setCurrent() then it has to extend a Displayable subclass.
    It sounds to me like you need to get yourself a book on Java (or at least work through an online tutorial) and learn the basics before you start on your projects. (I'm not trying to be rude or presumptuous or anything, just sounds like you need to start from the beginning, you know).

    shmoove

  3. #3
    Registered User
    Join Date
    Nov 2003
    Posts
    13
    yes shmoove i know that every class automatically extends Object class.

    The problem is i am getting a little bit confused with GameCanvas and Midlet and everything related to graphics... i am catching how things get into mobile screen...

    Uhmm i think i should not put a brick drawing himself right? or should i??

    Give me a best way of doing like a board with some bricks and putting them on screen by drawing a rectangle!

    I am having troubles about thinking a way of always getting the screen size even out of the Midlet Class. Is there a way?

    Regards

  4. #4
    Super Contributor
    Join Date
    Mar 2003
    Location
    Israel
    Posts
    2,280
    The screen size you get from the Canvas class (getWidth() and getHeight()).
    The brick class could draw itself. It needs a paint method that get a Graphics object as a parameter, and it draws itself onto that Graphics object using it's data.
    Why don't you download a few samples and browse through their code to see how things are usually done.

    shmoove

  5. #5
    Super Contributor
    Join Date
    Mar 2003
    Location
    Israel
    Posts
    2,280
    I just remembered a perfect example you can download:
    This is the game you're working on, right?
    (It's in MIDP 1.0 though, so no GameCanvas there)

    shmoove

Posting Permissions

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