Author Topic: How do you make the Images bigger?  (Read 4348 times)

Offline Hotshot

  • Mc. Print
  • *
  • Posts: 22
    • View Profile
How do you make the Images bigger?
« on: 2012-Aug-15 »
I want to make the image bigger but questions is which commands make the image go bigger?

Offline mentalthink

  • Prof. Inline
  • *****
  • Posts: 3375
  • Integrated Brain
    • View Profile
Re: How do you make the Images bigger?
« Reply #1 on: 2012-Aug-15 »
You can make in some ways.

rotozoomsprite my_Image, pos_X, pos_Y, angle, and the zoom factor  //Be carfully, 1.0 it´s the same size, but 10 not it´s 10 times, it´s very vey huge image, values <1.0 are for minimize, and when the value it´s <0.0 then the image flips.

Another way use polyvectors, (i don´t put the code, it´s a bit large), this method i´sabit more faster than drawsprite and the other commands for draw images
This nice whit polysprites, you can rotate, scale, distor the image and change colors in each vertex, and you can repeat a lot of time the image into the rectangle made whit polyvector.

You can see in the help, a simple mode for use it.

Another way in 3D, it´s use X_Sprite, this it´s only in 3D mode, and take a look to the lib of kanonet... have a very cool X_Sprite, do it for he.

Offline Hotshot

  • Mc. Print
  • *
  • Posts: 22
    • View Profile
Re: How do you make the Images bigger?
« Reply #2 on: 2012-Aug-15 »
Thanks:)

I am using 2D Sprites and hoping to create Basic 2D Shoot em up :)

Here the picture

« Last Edit: 2012-Aug-15 by Hotshot »

Offline Ian Price

  • Administrator
  • Prof. Inline
  • *******
  • Posts: 4176
  • On the shoulders of giants.
    • View Profile
    • My Apps
Re: How do you make the Images bigger?
« Reply #3 on: 2012-Aug-15 »
Xevious is a pretty good game to help with learn the ropes of GLB.

:)
I came. I saw. I played.

Offline Hotshot

  • Mc. Print
  • *
  • Posts: 22
    • View Profile
Re: How do you make the Images bigger?
« Reply #4 on: 2012-Aug-15 »
I am trying do Background scrolling of going up and I have create Global Move

Code: (glbasic) [Select]
FUNCTION SHOW_BACKGROUND:

        DRAWSPRITE BACKGROUND, 0, -5700+Move
        Move=Move-1

ENDFUNCTION

I just dont know why it got error when it say variable is not explicitly defined : Move as I guess I have to Declare Variable before I used it.......right?

Another things I have notice that GLBASIC only accept   JPG, BMP but not PNG......By the way....I am using free version and just let you know :)

Code: (glbasic) [Select]
GLOBAL BACKGROUND=0
GLOBAL Move AS INTEGER


LOADSPRITE "BACKGROUND2.JPG", BACKGROUND

SHOW_BACKGROUND()

SHOWSCREEN
MOUSEWAIT
END


FUNCTION SHOW_BACKGROUND:

        DRAWSPRITE BACKGROUND, 0, -5700+Move
        Move=Move-1

ENDFUNCTION


« Last Edit: 2012-Aug-15 by Hotshot »

Offline Poetronic

  • Mr. Drawsprite
  • **
  • Posts: 98
    • View Profile
Re: How do you make the Images bigger?
« Reply #5 on: 2012-Aug-15 »
Hi Hotshot,

GLBasic definitely supports png-files and transparency. I am making heavy use of them in my current project.

Concerning your questions:

Code: (glbasic) [Select]
GLOBAL Move AS INTEGER
should be

Code: (glbasic) [Select]
GLOBAL Move%
% means INTEGER, # means FLOAT, $ means STRING.

INTEGER can be used to convert floats into integers. You do it like this:

Code: (glbasic) [Select]
INTEGER(float#)
As for the background image, try doing it like this:

Code: (glbasic) [Select]
LOADSPRITE "yourimage.jpg", 0 // 0 instead of variable "yourimage"
This loads your image with ID 0. Use 1,2,3,4 etc. for more images. Then draw the sprite like this:

Code: (glbasic) [Select]
DRAWSPRITE 0, x%, y% // Draws the sprite with the ID 0 at the coordinates x, y
You can also stretch, rotate, and/or zoom your sprite:

Code: (glbasic) [Select]
STRETCHSPRITE num%, x%, y%, width%, height%
ROTOSPRITE num%, x%, y%, phi#
ROTOZOOMSPRITE num%, x%, y%, phi#, rel#
ZOOMSPRITE num%, x%, y%, relx#, rely#

I would also recommend two things for your project.

1. Try using a tile map with small images instead of one large image for the level background graphics.
2. Try coding your game so that it runs with the same speed on different computers (search for "deltatime" in this forum).

Cheers,
P.
« Last Edit: 2012-Aug-15 by Poetronic »
ILI-Blocks, my first game ever - please check it out! http://www.glbasic.com/forum/index.php?topic=8654.0

Offline Hotshot

  • Mc. Print
  • *
  • Posts: 22
    • View Profile
Re: How do you make the Images bigger?
« Reply #6 on: 2012-Aug-15 »
Thanks man :)

Quote
Try using a tile map with small images instead of one large image for the level background graphics.

That take lots of work to do as I only used it for learning project

I am wondering why my background doesnt scroll up.....

Code: (glbasic) [Select]
GLOBAL BACKGROUND=0
GLOBAL Move%


LOADSPRITE "BACKGROUND2.JPG", BACKGROUND

WHILE NOT TRUE

       SHOW_BACKGROUND()
       SHOWSCREEN

WEND

END

FUNCTION SHOW_BACKGROUND:

        DRAWSPRITE BACKGROUND, 0, -5700+Move
        Move=Move+1

ENDFUNCTION

deltatime? Yes, I will be using that when I got my learning project up, when it is ready and I will be using it :)



Offline Poetronic

  • Mr. Drawsprite
  • **
  • Posts: 98
    • View Profile
Re: How do you make the Images bigger?
« Reply #7 on: 2012-Aug-15 »
This works, just try to replace the values with your own:

Code: (glbasic) [Select]
GLOBAL Move%

SETSCREEN 640,480,0

REPEAT

     SHOW_BACKGROUND()
       
     SHOWSCREEN

UNTIL KEY(01) = 1 // ESC

END

FUNCTION SHOW_BACKGROUND:

     DRAWRECT 100, Move, 10, 10, RGB(255,255,255) // Replace with your image
       
     INC Move, 1 // This is the shorter version of Move = Move + 1; when using long veriable names this is much more handy

     IF Move > 480 THEN Move = 0

ENDFUNCTION

And tile maps are not such a great amount of work. Try using the DATA structure pointing to the specific tiles. Sounds complicated, but in fact it is rather simple. I don't have much time right now, but if you want to, I could try to explain it to you tomorrow or the day after :)

Cheers,
P.
« Last Edit: 2012-Aug-15 by Poetronic »
ILI-Blocks, my first game ever - please check it out! http://www.glbasic.com/forum/index.php?topic=8654.0

Offline Hotshot

  • Mc. Print
  • *
  • Posts: 22
    • View Profile
Re: How do you make the Images bigger?
« Reply #8 on: 2012-Aug-15 »
Thanks :)

Now I got Scrolling Background that go up! Nice one :)

Inc Move,1

That look like Assembler code doesnt it  LOL

Quote
And tile maps are not such a great amount of work. Try using the DATA structure pointing to the specific tiles. Sounds complicated, but in fact it is rather simple. I don't have much time right now, but if you want to, I could try to explain it to you tomorrow or the day afte

I did love know about that but no rush :)

Next step is put Spaceship in there and move about :)



Going to learn on Control the Spaceship and also Playing area to stop from Spaceship going off the screen :)
« Last Edit: 2012-Aug-15 by Hotshot »

Offline Hotshot

  • Mc. Print
  • *
  • Posts: 22
    • View Profile
Re: How do you make the Images bigger?
« Reply #9 on: 2012-Aug-15 »
I have managed control the spaceship and also got playing area working but one things bugged me is that Spaceship get stuck on the bottom.....

Code: (glbasic) [Select]
FUNCTION Show_Spaceship:

        DRAWSPRITE SpaceShip,250+MX,50+MY
       
        IF KEY(203) THEN DEC MX,SPEED     // LEFT
       
        IF KEY(205) THEN INC MX,SPEED     // Right
       
        IF KEY(200) THEN DEC MY,SPEED     // UP
       
        IF KEY(208) THEN INC MY,SPEED    // DOWN
       
        // STOP SPACESHIP GOING OFF THE SCREEN
        IF MX<-250   THEN MX=-250
        IF MX>350    THEN MX=350
       
        IF MY<215  THEN MY=215  // STOP SPACESHIP GOING OFF THE SCREEN AT THE BOTTOM   ------ PROBLEM !!!
       
ENDFUNCTION


What I am trying to do is Stop Spaceship going off the bottom where everythings is working apart from one things :)


UPDATED - I Got it working :)   The Correct Code is  IF MY>215  THEN MY=215  // STOP SPACESHIP GOING OFF THE SCREEN AT THE BOTTOM :D

My Next Step is get Spaceship Shooting  =D
« Last Edit: 2012-Aug-15 by Hotshot »

Offline bigsofty

  • Community Developer
  • Prof. Inline
  • ******
  • Posts: 2792
    • View Profile
Re: How do you make the Images bigger?
« Reply #10 on: 2012-Aug-15 »
Oooh Xevious, nice shmup choice!  :good:
Cheers,

Ian.

“It is practically impossible to teach good programming style to students that have had prior exposure to BASIC.  As potential programmers, they are mentally mutilated beyond hope of regeneration.”
(E. W. Dijkstra)

Offline Hotshot

  • Mc. Print
  • *
  • Posts: 22
    • View Profile
Re: How do you make the Images bigger?
« Reply #11 on: 2012-Aug-15 »
I am learning how to used Shooting by learning this tutorials Video   http://www.glbasic.com/forum/index.php?topic=935.0   

Excellent  =D