• Hey Guest! Ever feel like entering a Game Jam, but the time limit is always too much pressure? We get it... You lead a hectic life and dedicating 3 whole days to make a game just doesn't work for you! So, why not enter the GMC SLOW JAM? Take your time! Kick back and make your game over 4 months! Interested? Then just click here!

Legacy GM Creating phone text bubbles

Working on a cellphone-like text bubbles. I figured out how to display text, and make it move when the bubble moves. The view is also split to accommodate this However, I'm making this game in a low resolution.(90x150 vertical) so draw text is just unreadable or too big.
If I use drawgui text. then it works, but it's not positioned on the text bubbles properly. What do I do so the text is actually in the bubbles?

There's also the matter of creating new bubbles. I've tried having a controller get the id of the latest created bubble. but I'm stuck at that point. I figure the solution is to move all the bubbles up except for the bubble the controller has just created. but I don't know how to identify the latest bubble and move all of them as well. right now the bubbles just spawn at the same location eachtime, overlapping if they're not moved out of the way.

 
Last edited:

CloseRange

Member
If you didn't have to have the view it might be easier to use the draw gui event. Not to fear however this is completely possible to work with. As you may know the draw gui function works where 0, 0 is the exact top left corner of the visible screen meaning that no matter where you are the room or where the view is you will always see whatever is in the top left of the screen (this is great for a normal gui but not for this problem), but we can still use the coordinitates of the view to change our drawing position of the texts:

First of all i hope that the bubbles arn't objects because that could cause lag over time and not be useful, if they are i suggest just using either a draw_sprite of the bubble or a draw_roundrect. So before we address your first problem with views and resolution lets fix your second one and the best way to do that is to have an array system and create something like this:
Code:
/// Create Event
mtexts = 50; // Just the max amount of messages that can be displayed before they start to be deleted

for(i=0; i<=mtexts +1; i++)  { // The +1 is just so the array has an extra place holder
     bubbleX[i] = 0;
     bubbleY[i] = i *64 + view_xview +view_wview; // the 64 is just the bubble's height or how much you want each bubble to be spaced
     // You can also add/subtract numbers to this so that it isnt just right on the bottom of the screen
     bubbleT[i] = "";
// bubbleT is just for the text string to go in it
}


/// When Bubble is created
for(i=mtexts; i>=0; i--)  { // Notice this one goes in revurse
     bubbleX[i] = bubbleX[i-1];
     bubbleT[i] = bubbleT[i-1];
     // This sets all of the positions to the previous ones
}
bubbleX[0] = // This is where you set the x value, this can make it so that you can have it change between the sender and reciver (left side or right side)
bubbleT[0] = "fksdfds"; // This is where you have the input for the new text

// I dont change the Y positions because those will always remained the same positioning


/// Draw bubble
for(i=0; i<=mtexts; i++)   {
     if bubbleT[i] != "" {
          draw_sprite(spr_bubble, bubbleX[i], bubbleY[i]);
     }
}

This will allow the positions and texts to shift upward. Maybe dont just copy and past this code directly into your game, look over it and understand how it works first. It's a little confusing if you need further help just ask. For the second part ill try to make it a little simpler: Just take a normal x y position ( Like maybe x = 100 and y = 200 ) and then subtract the view_xview and view_yview so it becomes: x = 100 - view_xview; y = 200 - view_yview.

This can be dome like this:


Code:
for(i=0; i<=mtexts +1; i++)   {
     var xx = bubbleX[i] - view_xview;
     var yy = bubbleY[i] - view_yview;
     draw_text(bubbleT[i], xx, yy);
}
Hope this helped and if not just ask for further help and I'll do my best
-CloseRange :confused:
 

CloseRange

Member
If you didn't have to have the view it might be easier to use the draw gui event. Not to fear however this is completely possible to work with. As you may know the draw gui function works where 0, 0 is the exact top left corner of the visible screen meaning that no matter where you are the room or where the view is you will always see whatever is in the top left of the screen (this is great for a normal gui but not for this problem), but we can still use the coordinitates of the view to change our drawing position of the texts:

First of all i hope that the bubbles arn't objects because that could cause lag over time and not be useful, if they are i suggest just using either a draw_sprite of the bubble or a draw_roundrect. So before we address your first problem with views and resolution lets fix your second one and the best way to do that is to have an array system and create something like this:
Code:
/// Create Event
mtexts = 50; // Just the max amount of messages that can be displayed before they start to be deleted

for(i=0; i<=mtexts +1; i++)  { // The +1 is just so the array has an extra place holder
     bubbleX[i] = 0;
     bubbleY[i] = i *64 + view_xview +view_wview; // the 64 is just the bubble's height or how much you want each bubble to be spaced
     // You can also add/subtract numbers to this so that it isnt just right on the bottom of the screen
     bubbleT[i] = "";
// bubbleT is just for the text string to go in it
}


/// When Bubble is created
for(i=mtexts; i>=0; i--)  { // Notice this one goes in revurse
     bubbleX[i] = bubbleX[i-1];
     bubbleT[i] = bubbleT[i-1];
     // This sets all of the positions to the previous ones
}
bubbleX[0] = // This is where you set the x value, this can make it so that you can have it change between the sender and reciver (left side or right side)
bubbleT[0] = "fksdfds"; // This is where you have the input for the new text

// I dont change the Y positions because those will always remained the same positioning


/// Draw bubble
for(i=0; i<=mtexts; i++)   {
     if bubbleT[i] != "" {
          draw_sprite(spr_bubble, bubbleX[i], bubbleY[i]);
     }
}

This will allow the positions and texts to shift upward. Maybe dont just copy and past this code directly into your game, look over it and understand how it works first. It's a little confusing if you need further help just ask. For the second part ill try to make it a little simpler: Just take a normal x y position ( Like maybe x = 100 and y = 200 ) and then subtract the view_xview and view_yview so it becomes: x = 100 - view_xview; y = 200 - view_yview.

This can be dome like this:


Code:
for(i=0; i<=mtexts +1; i++)   {
     var xx = bubbleX[i] - view_xview;
     var yy = bubbleY[i] - view_yview;
     draw_text(bubbleT[i], xx, yy);
}
Hope this helped and if not just ask for further help and I'll do my best
-CloseRange :confused:
 
Top