Welcome, Guest. Please login or register.

Login with username, password and session length

 
Advanced search

1411528 Posts in 69377 Topics- by 58433 Members - Latest Member: Bohdan_Zoshchenko

April 28, 2024, 11:15:14 PM

Need hosting? Check out Digital Ocean
(more details in this thread)
TIGSource ForumsCommunityTownhallForum IssuesArchived subforums (read only)TutorialsGame Maker Tuts
Pages: 1 ... 5 6 [7] 8 9 ... 24
Print
Author Topic: Game Maker Tuts  (Read 355638 times)
Super_Stalin
Level 0
*


View Profile
« Reply #120 on: April 29, 2009, 07:46:53 PM »

i've got the circle working but i don't understand exactly how to do the blending.
Logged
Xion
Pixelhead
Level 10
******



View Profile WWW
« Reply #121 on: April 29, 2009, 09:39:17 PM »

You can set the blend mode to additive with draw_set_blend_mode(bm_add). Remember to reset the blend mode to bm_normal after you've drawn what you want to draw or everything will continue to be drawn thusly. So it should look like:

draw_set_blend_mode(bm_add)
draw_circle_color(stuff)
draw_set_blend_mode(bm_normal)

when in additive blend mode black will always be transparent and white opaque. Other colors will vary in transparency depending on their darkness or lightness (closer to black = more transparent & vice versa) so you can also draw sprites of light this way if you want a shape that's not a circle.

This is all assuming you've got the registered version?

If not you can just draw a few concentric circles of varying alpha intensity with draw_set_alpha(alpha) where alpha is between 0 and 1, 1 being opaque and 0 invisible.
Logged

Gainsworthy
Level 10
*****

BE ATTITUDE FOR GAINS...


View Profile
« Reply #122 on: May 07, 2009, 05:44:26 AM »

OOH! I HAVE QUESTIONS!  Evil

Just one, actually. Game Maker, Platformers and Lag. Is there a nice, easy way to disable objects one won't be used again? You know, like

Quote
if touch invisible_trigger_object_1
    destroy objects(in this boundary)

or equally, if I want to activate objects before I hit them

Quote
if touch invisible_trigger_object_2
    activate objects(in this boundary)


I know Spelunky activates and knocks out objects at will, so it's at least possible. I don't know if that approach could be used in my game (it's a reasonably conventional collect, jump on heads platformer with a decent amount of vertical AND horizontal movement) but any help will be appreciated and loved!


'Course, I could just shrink the room size. But that's no fun!
Logged
pgil
Guest
« Reply #123 on: May 07, 2009, 06:01:58 AM »

You can easily deactivate objects that are outside your screen.

from the manual:
Code:
 instance_activate_all();
 instance_deactivate_region(view_xview[0],view_yview[0],
                        view_wview[0],view_hview[0],false,true);

...will deactivate everything outside view 0. Though you'll probably want to make the active region a little larger than the view...

Also, your floor and wall objects should have a slightly wider active region that other things. This will prevent enemies from getting stuck in the floor..

Code:
instance_activate_object(..wall/floor object here...)
instance_deactivate_region(view_xview[0]-64,view_yview[0]-64,
                        view_wview[0]+64,view_hview[0]+64,false,true);
that goes right after the first code
Logged
ஒழுக்கின்மை (Paul Eres)
Level 10
*****


Also known as रिंकू.


View Profile WWW
« Reply #124 on: May 07, 2009, 06:20:51 AM »

Also, if you want to permanently disable an object because you never will use it again, like a bullet that just hit something, you destroy it with instance_destroy(). Deactivating instances is good when you will need them again sometime in the future.
Logged

Gainsworthy
Level 10
*****

BE ATTITUDE FOR GAINS...


View Profile
« Reply #125 on: May 07, 2009, 05:52:15 PM »

Thanks you two! I'm rather famliar with "instance_destroy()" but thanks. A little while ago I didn't really get that I could use it for everything and anything.

I did not notice "instance_Activate". Though. Heh. Sweet. I'll give that a shot once I get time again! Just to clarify, "deactivate" means "stop all actions," right? You know, like gravity, or old velocities, things like that. AND! What does the "false, true" at the end of that statement mean?

 Beer! Beer!
Logged
ChevyRay
Guest
« Reply #126 on: May 07, 2009, 08:38:37 PM »

Yeah, instance deactivate makes the object not do anything. All it's information and actions are frozen until you activate it again. It's a great function, and I'm pretty sure a greatly underestimated one as far as Game Maker usage goes.
Logged
GregWS
Level 10
*****


a module, repeatable in any direction and rotation


View Profile
« Reply #127 on: May 07, 2009, 08:41:31 PM »

Yeah, when I found out about it here (at some point over the past few months) I was horrified that I'd never heard of it, and had spent far too much time creating silly systems to allow for the kind of pausing it allows in some of my old half-finished games.  Tired

But yes, instance_deactivate/activate fucking rock!  Beer!
Logged
GregWS
Level 10
*****


a module, repeatable in any direction and rotation


View Profile
« Reply #128 on: May 07, 2009, 10:45:32 PM »

OK, GM question for the masters:

I want to keep my .gmk small and load my game's graphics externally.  I know this is possible, but when I try and do it I'm having no luck.

I think I'm screwing up somewhere when trying to get the file path through "working_directory/...etc." and when I use add_background, do I do something like back1 = add_background()?  Basically, how exactly do I keep track of the resources I'm loading?
Logged
ChevyRay
Guest
« Reply #129 on: May 08, 2009, 01:41:34 PM »

Yes, it loads the resource and the function returns an index you can use to access that resource. It's the exact same way that resources are handle internally, (except you can take it a step further and load them into lists, or arrays, to make dealing with them easier), and you can choose when to load them yourself, rather than having them all indexed and prepared at the game start.

What I'd do is simply use the same naming structure you use for backgrounds (or whatever) in general, and load them up. So like you said...

Code:
back1 = background_add(working_directory + "\RESOURCES\BACKGROUNDS\back1.png", 0, 0, 0);

Then you can use it freely. Keep in mind that working_directory is a variable that contains the string of the directory that the game is working from. So "working_directory\background.png" wouldn't work, because it would be looking for a local directory called "working_directory". So if you wanted to change the current room's background to that one we just loaded, you'd just do this:

Code:
background_index[0] = back1;
background_visible[0] = true;

You'll have to post your code if it still isn't working, and maybe I can figure out where you're going wrong.
Logged
GregWS
Level 10
*****


a module, repeatable in any direction and rotation


View Profile
« Reply #130 on: May 08, 2009, 04:57:30 PM »

Thanks Chevy!  Beer!

Yup, usually I would post code, but I was 99% sure it was wrong, so I thought I'd just explain the situation.  And it was definitely wonky code...and stuff that I should have known better about too (given that I've successfully used working_directory in the past, and could have found examples of had I dug through my old GM folders).  Embarrassed
Logged
Damian
Level 3
***



View Profile
« Reply #131 on: May 12, 2009, 02:59:21 AM »

So guys, a question needs an answer.

I want to make a background follow the obj_plr without effecting other objects and backgrounds, how would I go about doing this?

 Noir
Logged
ChevyRay
Guest
« Reply #132 on: May 12, 2009, 04:35:04 AM »

Code:
background_x[0] = obj_plr.x;
background_y[0] = obj_plr.y;

That will make only background[0] follow the player on the screen. If you want it to follow the view specifically, then you'd use this:

Code:
background_x[0] = view_xview[0];
background_y[0] = view_yview[0];

You would place this in the step event of something (I'd probably create an object to handle the backgrounds specifically, for organization purposes, if you don't already have a global level/game object or something).
Logged
Damian
Level 3
***



View Profile
« Reply #133 on: May 12, 2009, 06:43:13 AM »

Worked like a charm
Thanks
Logged
Rostiger
Pixelhead
Level 5
******



View Profile WWW
« Reply #134 on: May 29, 2009, 05:56:22 AM »

Hey, everyone!
I've been working on a small project the last couple of weeks, starting off with Derek's tutorials. I'm somewhere close to finishing, but have a problem with highscores that I just can't get over.

I'd like to save more than two values (name and score) to the highscore, since the overall score is made of three components: time, distance and points.
I've played around with various possible solutions like saving the data in an external file or trying to attactch the values to the name variable, but I'm afraid all those solutions are still a little too complex for me. Unfortunately I couldn't find fitting tutorials or examples since most of the only show how to make multiple highscore tables but not one with multiple values.

Basically I'd like to create a highscore table that is shown in the main menu and that can be edited after the game if the player gets a higher score than one of the ten slots.

Could anyone help me out with some code samples on how to archive this?  Beg
Logged

Clemens Scott
Co-Founder & Artist of Broken Rules
___
Vice President of Marketing, Romeo Pie Software
Level 10
*


View Profile
« Reply #135 on: May 29, 2009, 10:18:00 PM »

I'm going to ask a question.  Get ready.

How would I sort sort of a custom high scores set of data?  I plan on doing high scores in this project of mine, where the two bits of data for each score would be the score, and 3 initials to go with it.  I want to be able to save this data out to a file and read it back in when displaying high scores, and sort them from highest to lowest...  ThANkS Grin

edit:  this might work, but I've only done this on paper so far..
Code:
var i, high_scores_scores_sorted, high_scores_initials_sorted, high, high_id;

high_scores_initials_sorted = ds_list_create();
high_scores_scores_sorted = ds_list_create();

repeat(ds_list_size(global.high_scores_scores)) {
    high = 0;
    for (i = 0; i < ds_list_size(global.high_scores_scores); i += 1) {
        if (ds_list_find_value(global.high_scores_scores, i) > high) {
            high = ds_list_find_value(global.high_scores_scores, i);
            high_id = i;
        }
    }
    ds_list_add(high_scores_scores_sorted, high);
    ds_list_add(high_scores_initials_sorted, ds_list_find_value(global.high_scores_initials, high_id));
    ds_list_delete(global.high_scores_scores, high_id);
    ds_list_delete(global.high_scores_initials, high_id);
}

ds_list_copy(global.high_scores_scores, high_scores_scores_sorted);
ds_list_copy(global.high_scores_initials, high_scores_initials_sorted);
« Last Edit: May 30, 2009, 01:54:53 AM by xerus » Logged
MaloEspada
Guest
« Reply #136 on: June 01, 2009, 09:44:18 AM »

I too have a question to be answered. More likely a hard one.
I want to have a 'smooth camera' in my game, cause I dislike Game Maker's use of the views as a camera; I think the best way to describe this is "cave story-like camera".

A camera that follows the player "slowly". It basically moves kinda of slow-ish until it centers the screen.

Konjak's games and The Underside also feature this kind of camera...
Is this possible in Game Maker?
Logged
andy wolff
Level 10
*****


-------


View Profile
« Reply #137 on: June 01, 2009, 12:27:41 PM »

MaloEspada:

Instead of using the view borders and a view object, change view_xview and view_yview slowly. I like to use something like this:
Code:
///merge_number script
return (argument0+((argument1-argument0)*argument2))

///step event of controller object or main character object
view_xview[0]=merge_number(view_xview[0],x-view_wview[0]/2,.2) //change .2 to adjust speed
view_yview[0]=merge_number(view_yview[0],y-view_hview[0]/2,.2) //change .2 to adjust speed
Logged

MaloEspada
Guest
« Reply #138 on: June 01, 2009, 12:42:31 PM »

Wow, worked just like i wanted! Thank you Andy!!
Now I only have one little problem; I use an object to deactivave instances outside view and then activate the ones I want+the region within the view.


Quote
instance_deactivate_all(true);
instance_activate...etc (the objects I want active)
instance_activate_region(view_xview,view_yview,view_wview,view_hview,true);

Problem is, now you can see some instances activating and deactivating, which is kind of ugly so I want to make wider the region activated. I tried something here but I don't know what exactly change in the code.

Help?
Logged
PureQuestion
Level 4
****



View Profile
« Reply #139 on: June 01, 2009, 02:14:16 PM »

You could alter the parameters to activate slightly farther than the veiw actually reaches, IE:
instance_activate_region(view_xview-32,view_yview-32,view_wview+32,view_hview+32,true);
to increase the parameters by 32 pixels in all directions.

It's quite simple really.
The kind of simple where I've never tried this before, and I think I figured it out.  :D

In theory that would work. I may have gotten the signs wrong, but knowing game maker, I'd say I didn't.
Logged

Pages: 1 ... 5 6 [7] 8 9 ... 24
Print
Jump to:  

Theme orange-lt created by panic