Menu

Show posts

This section allows you to view all posts made by this member. Note that you can only see posts made in areas you currently have access to.

Show posts Menu

Topics - valter

#1
I don't know if we can call it bug but by creating a view of the character using "Flip Sprite" FaceDirection not working properly.
It's necessary to use existing sprites for each loop and FaceDirection will be fine.

[edit]
To be precise behavior is strange.
I had the loop Left, Left-Up and Left-Down mirrored.
Asking AGS perform FaceDirection(eDirectionUpRight) (this loop was not mirrored) was displayed eDirectionDownRight...
So I proceeded to mirror all frames manually and import them directly as sprite and assign them to the corresponding loop.
Now all directions work properly.
#2
Can I dynamically create a name for GUI declaration?
I have this code:

Code: ags

short bubbleHeight;
short lblBubbleHeight;

switch(increment)
{
case 1: 
    py = py - GetViewportY()-15-70;
    bubbleHeight = 70;
    lblBubbleHeight = 20;
    break;
case 2: 
    py = py - GetViewportY()-15-90;
    bubbleHeight = 90;
    lblBubbleHeight = 40;
    break;
case 3: 
    py = py - GetViewportY()-15-110;
    bubbleHeight = 110;
    lblBubbleHeight = 60;
    break;
case 4: 
    py = py - GetViewportY()-15-130;
    bubbleHeight = 130;
    lblBubbleHeight = 80;
}
bool bubble_out = (py <= 30);

// three GUIs are declared in the global variables
GUI *gSideSx;
GUI *gSideDx;
GUI *gSideCentre;
bool is_sx = px < (System.ViewportWidth / 2);
bool is_centre = ((!bubble_out) && (px - (tx / 2) > 30) && (px + (tx / 2) < (inv_ScreenResX - 30)));

if(is_centre) {
    if(increment == 1) { 
        gSideSx = gBubble_dim_sx_70; gSideDx = gBubble_dim_dx_70; gSideCentre = gBubble_centre_70;
    } else if(increment == 2) {
	gSideSx = gBubble_dim_sx_90; gSideDx = gBubble_dim_dx_90; gSideCentre = gBubble_centre_90;
    } else if(increment == 3) {
	gSideSx = gBubble_dim_sx_110; gSideDx = gBubble_dim_dx_110; gSideCentre = gBubble_centre_110;
    } else if(increment == 4) {
	gSideSx = gBubble_dim_sx_130; gSideDx = gBubble_dim_dx_130; gSideCentre = gBubble_centre_130;
    }
}
else if(is_sx) {
    if(bubble_out) {
        if(increment == 1) {
	    gSideSx = gBubbleOS_sx_70; gSideDx = gBubble_dim_dx_70;
	} else if(increment == 2) {
	    gSideSx = gBubbleOS_sx_90; gSideDx = gBubble_dim_dx_90;
	} else if(increment == 3) {
	    gSideSx = gBubbleOS_sx_110; gSideDx = gBubble_dim_dx_110;
	} else if(increment == 4) {
	    gSideSx = gBubbleOS_sx_130; gSideDx = gBubble_dim_dx_130;
	}
    [ ... ]


Currently I use a series of IF to assign gSideSx, gSideDx and gSideCentre correct GUI name.

If I could do something like:

Code: ags

String nameGui = "gBubble_dim_sx_";
nameGui = nameGui.Append(bubbleHeight); // bubbleHeight = 70 or 90 or 110 or 130
gSideSx = nameGui;


I could greatly reduce the code.
This above is just an example because of course raises error.

Is there a way to do something similar?
I've read all the manual several times but I haven't found any useful information.
In any case, are there alternative ways?

Valter
#3
Hi, I'm working on version 3.4.0.6.
Are in a "switch" statement allowed to use a construct "if else"?
I tried it and I found that it works fine.
Do you think that might cause unpredictable failures?
Thanks

Valter
#4
Greetings all,
if you want to use in the game Custom thought bubble GUI with Think() it happens that when the character is too close to the left or right, border of the bubble GUI it leaves the screen. The text is instead displayed correctly.
Custom thought bubble GUI can't be moved through code.

Valter

SMF spam blocked by CleanTalk