Jump to content


Photo

Changing Background


  • Please log in to reply
3 replies to this topic

#1 Scones1

Scones1

    GMC Member

  • New Member
  • 15 posts
  • Version:GM7

Posted 04 April 2012 - 09:44 AM

Hi all! I'm new here, this is my first post!

I am having trouble switching between backgrounds. I know how to swap from one background to another, but I have 4 screens I want to be able to swap between using 4 different buttons. I currently have the following code:

background_assign(Plain,background1)

So I can swap a plain background to a chosen background, but is there a way to change plain to "Any background" or something.

Please bear in mind I am INCREDIBLY NEW at this

Thankyou very much for your help :D

(Also I noticed there was a different forum for Mac and PC users! Does that mean PC users can't play my game?! :o)
  • 0

#2 Noele

Noele

    GMC Mentor

  • GMC Member
  • 2347 posts
  • Version:GM8.1

Posted 04 April 2012 - 10:23 AM

Each room can have up to 8 backgrounds (background0..background7) which you can make any or all visible when the room is created and you can also do so using code in-game. Backgrounds are drawn in order 0 to 7 so you can layer them and their starting x,y can be set. You can also stretch or tile them across or down to fill the screen.

Note a stretch or tiled background will fill the screen regardless of its x,y position.

Background0 is the first to be drawn and Background7 will be the last to be drawn. It will be drawn on top of all others.
You can also control them in code.
background_visible[0..7] Whether the particular background image is visible.
background_index[0..7] Background image index for the background.
background_visible[7] = true; // show background 7
background_visible[0] = false; // hide background 0
or change the image a background uses
background_index[0] = bg_my_back_image; // set image to use
In answer to you final question Mac and PC OS are different so you would need to create two versions, one using GM4Mac and one using GM8.
  • 0

#3 Scones1

Scones1

    GMC Member

  • New Member
  • 15 posts
  • Version:GM7

Posted 04 April 2012 - 12:37 PM

Each room can have up to 8 backgrounds (background0..background7) which you can make any or all visible when the room is created and you can also do so using code in-game. Backgrounds are drawn in order 0 to 7 so you can layer them and their starting x,y can be set. You can also stretch or tile them across or down to fill the screen.

Note a stretch or tiled background will fill the screen regardless of its x,y position.

Background0 is the first to be drawn and Background7 will be the last to be drawn. It will be drawn on top of all others.
You can also control them in code.
background_visible[0..7] Whether the particular background image is visible.
background_index[0..7] Background image index for the background.

background_visible[7] = true; // show background 7
background_visible[0] = false; // hide background 0
or change the image a background uses
background_index[0] = bg_my_back_image; // set image to use
In answer to you final question Mac and PC OS are different so you would need to create two versions, one using GM4Mac and one using GM8.


Beautiful help! :D I have it working now. What I did was

background_visible[0]=false
background_visible[1]=false
background_visible[2]=false
background_visible[3]=true
background_visible[4]=false

on each of the buttons(Depending on which one is clicked) It works like a charm. Thankyou very much.

About the Mac OS and getting 2 versions though, I am using GM7 on Mac(I have purchased the full version) Is it hard to get it onto PC? Im a bit worried nobody will be able to play it :D
  • 0

#4 Noele

Noele

    GMC Mentor

  • GMC Member
  • 2347 posts
  • Version:GM8.1

Posted 04 April 2012 - 01:35 PM

There are several OS and GM version differences so you would need GM8 as well. GM8.1 uses PNG graphics with full alpha transparency and Unicode fonts. It also has functions unavailable on Mac OS so even importing would most likely require some code modifications before compiling a PC version. It is more to do with OS differences.
GM Studio (when it is released) MAY be able to create Mac or PC executable but Studio itself is a Windows PC application.
  • 0




0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users