BASIC

Author Topic: Change 'hot spot' of sprite and Drawline thickness  (Read 3294 times)

Offline fjsantosb

  • Dr. Type
  • ****
  • Posts: 258
    • View Profile
    • Tip Tap Games - iPhone, iPad and iPod Touch Games
Hi there,

I wonder is there is a way to drawsprite by his center, i mean any way to change the 'hot spot' of the sprite.
I know I can use offsets to draw the sprite where must be, but I wonder is there is any method to change this.

In the other hand i wonder is there is any way to change the thickness of drawline (I would like to draw lines more thickness).

Thanks in advance,

Kig Regards, fjsantos.
Francisco Santos Belmonte founder of Tip Tap Games.
Website: www.tiptapgames.com
Twitter: www.twitter.com/tiptapgames
Facebook: http://dld.bz/dYVd
iPhone News & Sales: www.gamesappetizer.com

MrTAToad

  • Guest
Would be nice, but the only commands that use a different hotspot are those that rotate a sprite (at which point the centre of the sprite is used).

Offline Kitty Hello

  • code monkey
  • Administrator
  • Prof. Inline
  • *******
  • Posts: 10714
  • here on my island the sea says 'hello'
    • View Profile
    • http://www.glbasic.com

Offline fjsantosb

  • Dr. Type
  • ****
  • Posts: 258
    • View Profile
    • Tip Tap Games - iPhone, iPad and iPod Touch Games
Hi,

Thanks for the answer, i have found specially interesting the pivot point.

And about thickness of drawline? I am currently using 'X_Line' which can be specify the thick of the line, but i can get same 'effect' using only drawline command?

King Regards, fjsantos.
Francisco Santos Belmonte founder of Tip Tap Games.
Website: www.tiptapgames.com
Twitter: www.twitter.com/tiptapgames
Facebook: http://dld.bz/dYVd
iPhone News & Sales: www.gamesappetizer.com

Offline Kitty Hello

  • code monkey
  • Administrator
  • Prof. Inline
  • *******
  • Posts: 10714
  • here on my island the sea says 'hello'
    • View Profile
    • http://www.glbasic.com
you can try glLineWidth (there's an OpenGL wrapper on the forums somewhere)

Offline fjsantosb

  • Dr. Type
  • ****
  • Posts: 258
    • View Profile
    • Tip Tap Games - iPhone, iPad and iPod Touch Games
Thanks Gernot, i will take a look!

King Regards, fjsantos.
Francisco Santos Belmonte founder of Tip Tap Games.
Website: www.tiptapgames.com
Twitter: www.twitter.com/tiptapgames
Facebook: http://dld.bz/dYVd
iPhone News & Sales: www.gamesappetizer.com

Offline kamakazieturtle

  • Community Developer
  • Mr. Polyvector
  • ******
  • Posts: 103
    • View Profile
Code: GLBasic [Select]
GETSPRITESIZE Image,ImageSizeX,ImageSizeY
ImageCenterX=ImageX+(ImageSizeX/2)
ImageCenterY=ImageY+(ImageSizeY/2)
 

This will tell you the images center.

Offline fjsantosb

  • Dr. Type
  • ****
  • Posts: 258
    • View Profile
    • Tip Tap Games - iPhone, iPad and iPod Touch Games
Hi kamakazieturtle,

I actually use this code to get center of sprite (one time only, when i load the sprites, in the sprites type for speed purposes).
Thanks for sharing.

King Regards, fjsantos.
Francisco Santos Belmonte founder of Tip Tap Games.
Website: www.tiptapgames.com
Twitter: www.twitter.com/tiptapgames
Facebook: http://dld.bz/dYVd
iPhone News & Sales: www.gamesappetizer.com

Offline fjsantosb

  • Dr. Type
  • ****
  • Posts: 258
    • View Profile
    • Tip Tap Games - iPhone, iPad and iPod Touch Games
Hi there,

I finally find the wrapper that Gernot talks me about. The wrapper is:

Code: GLBasic [Select]
INLINE
#define OGL                             ::
typedef float           GLfloat;
ENDINLINE

INLINE
} extern "C" { void __stdcall glLineWidth( GLfloat width );; }; namespace __GLBASIC__ {
ENDINLINE
FUNCTION glLineWidth: width
        INLINE
                OGL glLineWidth(width);
        ENDINLINE
ENDFUNCTION
 

It's works like a charm! But I have a question:

When I compiled it's says 'Warning: Demo mode: This command would require Net or 3D addon'.

I currently have NET addon but not 3D. However it's seems is not in demo mode, cause i can't see the 'demo' image on screen.

Can anyone confirm that with NET addon is enough to compile this?

King Regards, fjsantos.
Francisco Santos Belmonte founder of Tip Tap Games.
Website: www.tiptapgames.com
Twitter: www.twitter.com/tiptapgames
Facebook: http://dld.bz/dYVd
iPhone News & Sales: www.gamesappetizer.com

Offline Kitty Hello

  • code monkey
  • Administrator
  • Prof. Inline
  • *******
  • Posts: 10714
  • here on my island the sea says 'hello'
    • View Profile
    • http://www.glbasic.com
oh.
You need the premium for INLINE.

Try this instead:
IMPORT "C" void glLineWidth(float);
and try to use it as if it was an GLBasic command.

Offline fjsantosb

  • Dr. Type
  • ****
  • Posts: 258
    • View Profile
    • Tip Tap Games - iPhone, iPad and iPod Touch Games
Hi Gernot,

Works like a charm!

Anyway, what is the premium module?

King Regards, fjsantos.
Francisco Santos Belmonte founder of Tip Tap Games.
Website: www.tiptapgames.com
Twitter: www.twitter.com/tiptapgames
Facebook: http://dld.bz/dYVd
iPhone News & Sales: www.gamesappetizer.com

Offline Kitty Hello

  • code monkey
  • Administrator
  • Prof. Inline
  • *******
  • Posts: 10714
  • here on my island the sea says 'hello'
    • View Profile
    • http://www.glbasic.com
premium = 2D+3D+NET.

Offline fjsantosb

  • Dr. Type
  • ****
  • Posts: 258
    • View Profile
    • Tip Tap Games - iPhone, iPad and iPod Touch Games
Very interesting,

I am currently working on 2 games on 2D, but i will probably buy 3D module in a few moths for the next games (3D time)!

King Regards, fjsantos.
Francisco Santos Belmonte founder of Tip Tap Games.
Website: www.tiptapgames.com
Twitter: www.twitter.com/tiptapgames
Facebook: http://dld.bz/dYVd
iPhone News & Sales: www.gamesappetizer.com