Jump to content


Panda_196

Member Since 24 Feb 2011
Offline Last Active Sep 18 2012 11:15 AM

Topics I've Started

Sprite Properties Issues [Solved]

01 November 2011 - 12:06 PM

Hey GMC,

I'm probably missing something really obvious, but I can't seem to make sprite_width or sprite_height to work. I'm using a 128x64 white box for the spr_menu_button with the origin at 64x32.

width = (spr_menu_button.sprite_width)/2;
show_message(width); //Gives 0
height = (spr_menu_button.sprite_height)/2;
show_message(height); //Gives 0

It should be giving 64 and 32 but I can't seem to work out why. I tried changing spr_ to obj_ but that threw an unknown variable error which is understandable. Also I know they're the right names as it has coloured spr_menu_button yellow and sprite_height/sprite_width red.

Thanks in advance.  :happy:

Collision with non-solid object /Paths not working

25 October 2011 - 01:45 PM

Hi guys,

I'm currently trying to get some decent AI but I'm having issues with collision events. The AI has to break down a wall to get to the main part of the map. The problem is that when the AI spawns it targets a particular wall to destroy, so rather than destroy the wall when it's broken down by the AI I've put:

//par_break_wall step event:
if (resist == 0)
{
    solid = false;
    visible = false;
}

However this causes the problem, which is that I then put the AI on a path which should end up in the main part of the room, going through the space where the now invisible and non-solid wall is, however it doesn't move. I've come to the conclusion that this is because the wall which it breaks is still there, as when I changed it so that the breakable wall was destroyed the path worked fine, but caused the next lot of AI to have issues as it has nothing to target.

I have got this in the 'Collision with par_break_wall' (parent object for the breakable walls) event, where spd is the variable for the path speed:

if (target.resist > 0)
{
    spd = 0;
}
else
{
    spd = 1;
}

Thanks in advance, Panda  :laugh:

globalvar issues

28 September 2011 - 05:41 PM

I'm receiving an error stating that the variable 'start_pos' is not recognised:

Error in code at line 1:
   switch (start_pos)
          ^
at position 9: Unknown variable start_pos


This seems a bit strange as I initialise it in the 'Game Start' event of my controller object like so:

//Game Start event
globalvar room_x,room_y,start_pos;
room_x = 0;
room_y = 0;
start_pos = 0;

And then in the object giving me the error in the create event I have:

//Create Event
switch (start_pos)
{
    case 0:
    {
        x = 594;
        y = 297;
    }
    case 1:
    {
        x = 330;
        y = 66;
    }
    case 2:
    {
        x = 66;
        y = 297;
    }
    case 3:
    {
        x = 330;
        y = 429;
    }
    default:
    {
        x = 330;
        y = 297;
    }
}

Any idea why?
Thanks, Panda

String functions and various encryption questions

13 September 2011 - 08:05 PM

Hi GMC, I've got a few questions I was hoping you'd help me with.

Question 1:
Spoiler


Question 2:

How much would the game be slowed down by if you ran your variables through multiple encryption ciphers, and how much more effective would it be compared to one encryption? I mean if you encrypt say 3 times using keywords it must be difficult to find out all three keywords  if they've been encrypted by the other ciphers? My understanding of encryption isn't great at the moment so any explanation is appreciated.  :happy:

Question 3:

Reading about keyword based encryptions I get the impression that you need to hide the keyword but how would you go about that? Surely the hacker is able to read any variables you store it in?

N.B. I understand that any determined hacker *could* break an encryption but I'm just interested and it's getting me to use the file_text_* functions which I'm finding useful in learning about GML.   :turned:

Question 4:

When would the binary file functions be used over the file_text_* functions and why?

Thanks, Panda

Object draws text but it's not visible itself.

04 June 2011 - 05:36 PM

Sometimes when I get an object drawing text it draws the text but the object is not visible. In my controller object I've got in the room start event:
if room != rm_start
{
    instance_create(320,96,obj_level_banner);
}

And for my obj_level_banner I've got:
Information about object: obj_level_banner

Sprite: spr_level_banner
Solid: true
Visible: true
Depth: -100
Persistent: false
Parent: <no parent>
Mask: <same as sprite>

Create Event:
execute code:

alarm[0] = room_speed*4;


Alarm Event for alarm 0:
execute code:

instance_destroy();


Draw Event:
execute code:

//Settings
draw_set_color(c_white);
draw_set_alpha(1);
draw_set_valign(fa_middle);
draw_set_halign(fa_middle);
draw_set_font(ft_banner);
//Draw level
draw_text(x,y-5,banner_level());

Any help is appreciated. :)