Sorry your browser is not supported!

You are using an outdated browser that does not support modern web technologies, in order to use this site please update to a new browser.

Browsers supported include Chrome, FireFox, Safari, Opera, Internet Explorer 10+ or Microsoft Edge.

Newcomers AppGameKit Corner / HELP: Trying To Create A Box In The Center of The Screen Doesn't Work

Author
Message
Lunar Scorpion Games
7
Years of Service
User Offline
Joined: 1st May 2016
Location:
Posted: 29th May 2016 04:12
Hi,

I am trying to create a box in the center of the screen which will represent a street. I am using this code to do so:


However when i try to runit all i get is the background color which may mean i am not drawing the box correctly. Here is the full source code:

Any assistance in this matter would be greatly appreciated.

Sincerely,

Developer
BatVink
Moderator
21
Years of Service
User Offline
Joined: 4th Apr 2003
Location: Gods own County, UK
Posted: 29th May 2016 21:19
DrawBox() is a command that you have to repeat every loop. It is not a persistent entity.

If you are wanting a permanent box without haveing to draw every time, you should use an image of a box and createSprite() from it.
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
Quidquid latine dictum sit, altum sonatur
TutCity is being rebuilt
Lunar Scorpion Games
7
Years of Service
User Offline
Joined: 1st May 2016
Location:
Posted: 31st May 2016 07:04
Quote: "
DrawBox() is a command that you have to repeat every loop. It is not a persistent entity.

If you are wanting a permanent box without haveing to draw every time, you should use an image of a box and createSprite() from it.
"

Great that makes sense thanks, except how do i resize my box image/sprite if the size of the game screen isn't the default 1024 * 768?

Sincerely,

Lunar Scorpion Games
BatVink
Moderator
21
Years of Service
User Offline
Joined: 4th Apr 2003
Location: Gods own County, UK
Posted: 31st May 2016 08:55
Firstly, you need to setVirtualresolution() or work in the default percentage system. (I prefer to set my own virtual resolution)

Once you have done this, the size of the actual device is irrelevant, you work to the resolution you have set. AppGameKit will do everything else for you.
I work with a widescreen resolution (e.g 1920 x 1080), 1024x768 has only about 3% usage now.
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
Quidquid latine dictum sit, altum sonatur
TutCity is being rebuilt

Login to post a reply

Server time is: 2024-04-14 16:15:39
Your offset time is: 2024-04-14 16:15:39