Jump to content


oblivious

Member Since 09 Nov 2008
Offline Last Active Sep 13 2011 07:56 AM

Topics I've Started

Building my own inventory

15 August 2011 - 12:47 PM

Hi all, I recently started building my own inventory since it seemed like a fun thing to do. Altho I started out ok I'm having some problems with moving items from 1 square to the other. here is the code I use:

// when the mouse is released check if the inventory is still open and that there is an item selected (999 means no item)
if (global.gamepause == 1) && (global.onmouse != 999) {
    blockcheck = collision_point(window_view_mouse_get_x(0),window_view_mouse_get_y(0),obj_invblock,1,0);
    //check if the item is released on another obj_invblock
    if (blockcheck != -4) {
        if (blockcheck.content == 0){
            blockcheck.content = global.onmouse
            ds_grid_set(global.inventory,blockcheck.dsx,blockcheck.dsy,global.onmouse);
            global.onmouse = 999;
            global.oldx = 999;
            global.oldy = 999;
        } else {
            show_message("You broke it!!!");
        }
    // If the item is released somewhere else put it back in its original position
    } else if (global.onmouse != 999)&& (blockcheck = -4){   
            ds_grid_set(global.inventory,global.oldx,global.oldy,global.onmouse);
            global.onmouse = 999;
            global.oldx = 999;
            global.oldy = 999;
    }
} 

this is all in an inventory controller object and in the global mouse release event.

The code works fine when i release it in an open slot. The problem is that I want it to return to it's old position when you drop it somewhere else (so not on object_invblock).
When I debug it the variables oldx and oldy have the right values in them. I also tried changing the ds_grid_set to:
ds_grid_set(global.inventory,real(global.oldx),real(global.oldy),global.onmouse);

Could someone help me out here?

Interface question

07 July 2011 - 09:48 AM

**EDIT* since i havent woken up properly i wrote the damn thing in Dutch, my bad.

I have a question about a game I'm making, I want to switch the interface I have to a new one (see attached picture)But i'm not sure how to do this. I have thought of 2 ways of doing it but was wondering what your opinions are on the subject

idea #1: Make a room with 2 views and keep one place of the room empty. make a controller object which creates all the stuff I want to show in the empty space in the room and make that view 2 en let view 1 focus on the player and walking around. The drawback of this is that I have to use 2 views and keep 1 part of every room i'm going to make empty just for this to work, I don't like that idea.

The 2nd idea I had was creating an object at the bottom of the screen with all the info/details in it. The problem is that I will have to keep an empty space at the bottom of every room aswell with the height of the object to stop it blocking the room itself. which is also extra work I prefer not to do.

I'd like to know if there is a way to use 2 views, where the 2nd view just shows an object instead of a part of the room?

this is the setup i'd want.
Posted Image

regards
Oblivious

Movement problem

05 July 2011 - 11:47 AM

Hi all I'm trying to make a game where a character has grid like movement. the problem with the movement is that I want the player to keep moving when I have the button down, but stop moving when I release it. for that I use this code in the keyboard<any> event:
if ((keyboard_check(vk_left) || keyboard_check(ord('A'))) && place_free(x-30,y))
  {
  x-=30;
  }
if ((keyboard_check(vk_right) || keyboard_check(ord('D'))) && place_free(x+30,y)) 
  {
  x+=30;
  }
if ((keyboard_check(vk_up) || keyboard_check(ord('W')) )&& place_free(x,y-30))
  {
  y-=30;
  }
if ((keyboard_check(vk_down)|| keyboard_check(ord('S'))) && place_free(x,y+30))  
  {
  y+=30;
}

The problem is that it checks this every step, so with a standard room speed of 30 he keeps shooting trough the level. I would like to know if there was a way of changing this to a better speed without lowering the speed of the room?

greetings,
Oblivious

Looking For A Team As A 2d Programmer

07 May 2010 - 06:40 AM

Hi all,

I have recently picked up Game maker again. I started learning game maker back with GM 3 for a school project (where i got to meet mark Overmars as well) after my first game i stopped for a while until back at version 6 where i picked it up again and started learning GML. I have since helped a couple of friends of mine with a 2d RPG which failed miserably because well... we we're rubbish :). I have tried a couple of other programming languages after that (c# with XNA, c++ and java) but i lost interest due to the lack of time i had to really focus on learning the language.

Now i am back and ready to start learning again. i have bought GM8 pro and played around a but (especially with INI and normal files) on trying to create a nice top-down game but unfortunately i must admit my ambitions where a bit too big. I've now decided that working in a team is best for me because that way i can keep motivated and have someone else to fall back on for questions etc. Like every game maker in the making i'm fascinated by RPG style games but knowing the chances of ever completing it are slim i'm open to any kind of game (preferably no 2d platform games due to my lack of experience there).

A Little info about myself
I'm 22 years old and live in Holland. I work full time in a company as an IT specialist. I have about 2 years (combined) experience in working with GM (GML as well as D&D).

If you need someone with a little coding experience but a lot of will to learn more feel free to send me a PM.

Regards,
Oblivious

Need Some Help Explaining Data Structures

06 May 2010 - 09:18 AM

Hi everyone,

I've been working with game maker for a while now and i can't really get my head around the whole data structures. I'm wondering if there is someone who could explain to me why we should use them and if there is a good tutorial somewhere on how to use them.

regards,
Oblivious