Jump to content


Photo

different issue with BackGround create


  • Please log in to reply
9 replies to this topic

#1 robinsblade

robinsblade

    GMC Member

  • GMC Member
  • 661 posts
  • Version:GM8

Posted 27 June 2012 - 09:57 AM

i have it set so that global.Pause_Background = background_create_from_screen(view_xview[0],view_yview[0], 1200,630,false,true)
is in Pkey Pressed event and my issue is that it only draws the background once.

So this is for me to be able to have the background of the pause menu set as the last thing the player viewed in the main room.
My issue is that once the player goes in the pause menu and back out. then once again back into the pause menu the background is the same thing. ( So no update. ) how can i fix this i tried putting it in a step event but once again it did the same thing but only the very first thing the player viewed.

i didnt know if i should have made a new thread for this so i did....here is the old one.
http://gmc.yoyogames...howtopic=545012
  • 0

#2 eltantillo

eltantillo

    GMC Member

  • GMC Member
  • 328 posts

Posted 27 June 2012 - 12:12 PM

Hmm take a look at this, its a little thing i made using the code u posted, use the right key to move the sprite, then enter to go to the other room and draw the screen as backgorund, press enter again to return to the room where you can move the sprite to the right.
Download 001.gmk from Host-A
  • 0

#3 robinsblade

robinsblade

    GMC Member

  • GMC Member
  • 661 posts
  • Version:GM8

Posted 27 June 2012 - 12:49 PM

nope still not what im trying to acomplish bc the type of game im trying to make is a turret defense game i have the main room set to
persistant. and i made your rooms persistant and it still caused the same issue.

If i didnt make it clear.

My issue is that create background from screen only makes 1 background and it wont change if you try to do it again.... ive tried to delete it after
its used but it causes more issues then i tried changeing its value but that didnt work. i might try a few more things and if not im just going to leave
it till i can find a better fix.
  • 0

#4 robinsblade

robinsblade

    GMC Member

  • GMC Member
  • 661 posts
  • Version:GM8

Posted 27 June 2012 - 12:53 PM

here is a link to my game try it. Press P to pause and just pause and unpause the game a few times and look how the background stays the same and does not update.....if that makes sense http://www.host-a.ne...nsblade/.2.gm81
  • 0

#5 eltantillo

eltantillo

    GMC Member

  • GMC Member
  • 328 posts

Posted 27 June 2012 - 09:34 PM

Ok i fixed the issue, in a very personal way, i dont like persistent objects, rooms, or global variables, I tend to use files to carry over data from room to room. Your Issue was something between the persistent object, and the global variable, just made the global variable a local one, and that fixed the error

Download 2.gm81 from Host-A
  • 0

#6 robinsblade

robinsblade

    GMC Member

  • GMC Member
  • 661 posts
  • Version:GM8

Posted 28 June 2012 - 05:00 AM

nope its still doing the same thing. so this didnt fix my issue but i see where your getting at and ima try to fix it atm.
and im going to use a tut i found to compare results because they got it right but with alot of extra code.
  • 0

#7 robinsblade

robinsblade

    GMC Member

  • GMC Member
  • 661 posts
  • Version:GM8

Posted 28 June 2012 - 05:17 AM

this is what im trying to accomplish without all the rotating and all the buttons that they have.....
http://gmc.yoyogames.com/index.php?showtopic=505020

look at every time you pause there game compared to mine. thier background looks like the game right before you pause. Mine always looks the same.

Spoiler



this image show on the top left unpaused then top right paused.....the background looks good.

but on the bottom right is after you unpause it again. and do a few things in game. Bottom right shows that the background did not update.

i have highlighted the spots to look at in those two images.
  • 0

#8 robinsblade

robinsblade

    GMC Member

  • GMC Member
  • 661 posts
  • Version:GM8

Posted 28 June 2012 - 05:59 AM

*edit* i found an issue lucky i posted the file :D but i found that the sprite is not delete and is filling up ram so is there something wrong with my code?


ok i got what im looking for....instead of posting all the code i will post the game since i had to do almost a overhaul on the code....


http://www.host-a.ne...Pause_Code.gm81


i would have not gotten this if it wasnt for your help and the code from the tutorial i posted before.

Edited by robinsblade, 28 June 2012 - 06:19 AM.

  • 0

#9 eltantillo

eltantillo

    GMC Member

  • GMC Member
  • 328 posts

Posted 28 June 2012 - 06:38 AM

*edit* i found an issue lucky i posted the file :D but i found that the sprite is not delete and is filling up ram so is there something wrong with my code?


ok i got what im looking for....instead of posting all the code i will post the game since i had to do almost a overhaul on the code....


http://www.host-a.ne...Pause_Code.gm81


i would have not gotten this if it wasnt for your help and the code from the tutorial i posted before.


to free the sprite from memory use sprite_delete("global.sprite")
  • 0

#10 robinsblade

robinsblade

    GMC Member

  • GMC Member
  • 661 posts
  • Version:GM8

Posted 28 June 2012 - 10:02 AM

*edit AGAIN* um my ram must have been fluttering bc i just held the pause button for 10+ mins and ram is relativaly the same :D so it should be fine

well i got that in my code but my ram slowly raises if you hold the pause button i have something counting the amount of images under the global variable. and it keeps raising. so am i doing it wrong?


*edit* what doesnt make sence is the code must be working bc i only get an error of the code if there is no
sprite but i dont get the error so the code should be doing what its supposed to.

if room = MainRoom {sprite_delete(global.Pause_Background) instance_destroy()}

this is my code for destroy the object that makes the sprite and deletes the sprite(yes global.Pause_Background is ths sprite)

Edited by robinsblade, 28 June 2012 - 01:04 PM.

  • 0




0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users