Go to page Previous  1, 2, 3, 4, 5, 6, 7, 8 ... 41  Next  [ 816 posts ]  Reply to topicPost new topic 
Coding Help, Questions and Issues relating to coding
Author Message
 [gb]
 Post subject: Re: Coding Help
PostPosted: Wed Jul 24, 2013 12:30 am 
I never really was on your side.
Member
[*]
[*]
[*]
[*]
[*]

[*]
[*]
[*]
[*]
Well, if the direction is changing by 1 pixel each step, that should give it a 360 pixel circumference, or about a 115 pixel diameter, or even further, about a 57 pixel radius.

If you would like to have each platform a fixed distance away from a point, i suggest using variables that can be differentiated in the creation code.
EG:
Code:
x += xspeed;
y += yspeed;

dir += 1;
xspeed = lengthdir_x(increment, dir);
yspeed = lengthdir_y(increment, dir);


If you want to avoid doing a bunch of math to find out the distance, putting this in the creation code in the room should work:
Code:
local.distance=xxxxxxx
local.circumference=local.distance*2*pi
increment=(local.circumference/360)


substitue "xxxxxxx" with the distance away from the point

 
Top
Offline 
 User page at mfgg.net
 
 [vn]
 Post subject: Re: Coding Help
PostPosted: Wed Jul 24, 2013 10:08 am 
User avatar
Member
I need help.I tried to make goomba(obj) learned from Catezeey's OSMB engine(DE7 is somehow complicated for me) ,I add new objs for it but when i test it didn't get stomp,it just hurted me.Did I miss anything?

 
Top
Offline 
 User page at mfgg.net
 
 [ca]
 Post subject: Re: Coding Help
PostPosted: Wed Jul 24, 2013 12:56 pm 
User avatar
The Quantifiably Quip-tic QC Dude
Member
[*]
[*]
[*]
[*]
[*]

[*]
[*]
[*]
[*]
[*]

[*]
[*]
[*]
[*]
[*]

[*]
Im the Red Spy wrote:
Incredibly helpful stuff:
Spoiler:

Ah, works perfectly. Thanks for the help, Spy. :)

_________________
<insert funny sig image here>

Image Refs - Something new's gonna show up here, I just know it! - DeviantArt - YouTubeImage
???!, 10%
 
Top
Offline 
 User page at mfgg.net
 
 [gb]
 Post subject: Re: Coding Help
PostPosted: Wed Jul 24, 2013 1:54 pm 
I never really was on your side.
Member
[*]
[*]
[*]
[*]
[*]

[*]
[*]
[*]
[*]
Always glad i can help! Youre welcome!

minhmeo237 wrote:
I need help.I tried to make goomba(obj) learned from Catezeey's OSMB engine(DE7 is somehow complicated for me) ,I add new objs for it but when i test it didn't get stomp,it just hurted me.Did I miss anything?

Can you post your collision event in your goomba object for when it collides with Mario?

 
Top
Offline 
 User page at mfgg.net
 
 [us]
 Post subject: Re: Coding Help
PostPosted: Wed Jul 24, 2013 4:33 pm 
User avatar
Member
[*]
[*]
[*]
[*]
[*]

[*]
[*]
[*]
[*]
Yoshbert wrote:
I've been figuring out how to get the color value around the open tag ([color=c_red]).

Code:
string_copy("[color=c_red]", string_pos("[color=", "[color=c_red]") + 7, string_pos("]", "[color=c_red]") - string_pos("[color=", "[color=c_red]") - 1 );


No luck with implementing it into the engine, though.


I tried working with this problem for a bit today and came up with something really simple. This is mainly a start and nowhere near as flexible as it should be. I'll just be posting the code because it is quite short.

1.) Create an object
2.) Create two scripts: [message] and [message_get_color]
3.) message ( string )
Code:
// message ( string )
var str, str_tag, str_pos_color, char_width, char_height, char_pos_x, char_pos_y;
str = argument0;
char_width = 8;
char_pos_x = 0;
char_pos_y = 0;
for (i=1; i<=string_length (str); i+=1) {
   
    // obtain the [open color]
    if (string_char_at (str, i) == '[') {
        index = 0;
        while (string_char_at(str, i + index) != ']') index += 1;
        str_tag = string_copy (str, i, index + 1);
        message_set_color (str_tag);
        str = string_delete (str, i, index + 1);
    } 
   
    draw_text (0 + char_pos_x, 0, string_char_at (str, i));
    char_pos_x += char_width;
}

draw_set_color (c_black);

4.) message_get_color ( string )
Code:
// message_set_color ( string )
var str;
str = argument0;

switch (str) {
    case "[color=c_black]": draw_set_color (c_black); break;
    case "[color=c_red]"  : draw_set_color (c_red);   break;
    case "[color=c_blue]" : draw_set_color (c_blue);  break;
    default: draw_set_color (c_black); break;
}

5.) Object's Draw Event [two versions to show as example]
Code:
message ("H" + "[color=c_red]" + "el" + "[color=c_blue]" + "lo");

or
Code:
message ("H[color=c_red]el[color=c_blue]lo");

 
Top
Offline 
 
 
 [vn]
 Post subject: Re: Coding Help
PostPosted: Thu Jul 25, 2013 1:03 am 
User avatar
Member
Im the Red Spy wrote:
Always glad i can help! Youre welcome!

minhmeo237 wrote:
I need help.I tried to make goomba(obj) learned from Catezeey's OSMB engine(DE7 is somehow complicated for me) ,I add new objs for it but when i test it didn't get stomp,it just hurted me.Did I miss anything?

Can you post your collision event in your goomba object for when it collides with Mario?

Well here I just learned from OSMB engine:
Spoiler:

 
Top
Offline 
 User page at mfgg.net
 
 [gb]
 Post subject: Re: Coding Help
PostPosted: Thu Jul 25, 2013 1:31 am 
I never really was on your side.
Member
[*]
[*]
[*]
[*]
[*]

[*]
[*]
[*]
[*]
You may want to check where the sprite's y origin is at. If it is a 32 pixel tall sprite and the origin is at 16, then that wont work.
If it is at 16 and the sprite is 32 pixels tall, for example, this code would work better:
Code:
if other.y < y-15+other.vspeed
{
sound_play(snd_stomp)
instance_create(x,y,obj_stomped)
with (other) event_user(1);
instance_destroy()
}


And for the goomba not hurting Mario. I don't know why its there, but its checking to see if mario's y coordinate is greater than the goomba's y coordinate minus four. This would only be possible if the sprites y origin would be around 16 pixels from the bottom

 
Top
Offline 
 User page at mfgg.net
 
 [vn]
 Post subject: Re: Coding Help
PostPosted: Thu Jul 25, 2013 5:36 am 
User avatar
Member
Tks.But when I stomped on it hurted me.

 
Top
Offline 
 User page at mfgg.net
 
 [ca]
 Post subject: Re: Coding Help
PostPosted: Thu Jul 25, 2013 12:32 pm 
User avatar
The Quantifiably Quip-tic QC Dude
Member
[*]
[*]
[*]
[*]
[*]

[*]
[*]
[*]
[*]
[*]

[*]
[*]
[*]
[*]
[*]

[*]
kremling wrote:
Full post:
Spoiler:

Hm, this method looks much easier to follow. I'm gonna use this as an example. Thanks for the help, Kremling.

_________________
<insert funny sig image here>

Image Refs - Something new's gonna show up here, I just know it! - DeviantArt - YouTubeImage
???!, 10%
 
Top
Offline 
 User page at mfgg.net
 
 [us]
 Post subject: Re: Coding Help
PostPosted: Thu Jul 25, 2013 2:55 pm 
User avatar
Member
[*]
[*]
[*]
[*]
[*]

[*]
[*]
[*]
[*]
Yoshbert wrote:
Hm, this method looks much easier to follow. I'm gonna use this as an example. Thanks for the help, Kremling.
If you want to, we can both put some effort into making this quite flexible.

 
Top
Offline 
 
 
 [ca]
 Post subject: Re: Coding Help
PostPosted: Sun Jul 28, 2013 4:39 pm 
User avatar
The Goomba Guy
Member
[*]
[*]
[*]
I need help with platforms that move on a line. The platform has gravity but it moves on a line until the line ends and it falls or something like NSMBWii. I also need this to work with touch to move platforms. I am talking about those line paths that you place for platforms to move. The code should work with objects like coins or fuzzies.

_________________
Image
 
Top
Offline 
 User page at mfgg.net
 
 [tr]
 Post subject: Re: Coding Help
PostPosted: Sun Jul 28, 2013 5:42 pm 
User avatar
Thanks DonnieTheGuy!
Administrator
[A]
[*]
[*]
[*]
[*]

[*]
[*]
[*]
[*]
[*]

[*]
[*]
[*]
[*]
[*]

[*]
[*]
[*]
[*]
[*]

[*]
Try using paths.

_________________
Image
 
Top
Offline 
 
 
 [ca]
 Post subject: Re: Coding Help
PostPosted: Mon Jul 29, 2013 6:02 pm 
User avatar
The Goomba Guy
Member
[*]
[*]
[*]
Well paths can get confusing after a while because I have to make a path for every object on the line. If they all use the same path they will go out of the line.

_________________
Image
 
Top
Offline 
 User page at mfgg.net
 
 [tr]
 Post subject: Re: Coding Help
PostPosted: Mon Jul 29, 2013 6:11 pm 
User avatar
Thanks DonnieTheGuy!
Administrator
[A]
[*]
[*]
[*]
[*]

[*]
[*]
[*]
[*]
[*]

[*]
[*]
[*]
[*]
[*]

[*]
[*]
[*]
[*]
[*]

[*]
Ok. Use creation codes like this:
Code:
varpath = path0

And add this to create event:
Code:
alarm[0] = 1

And add this to alarm 0:
Code:
path_start(varpath,2,blah,blah)

This makes using paths easier.
Also why I didn't using this?

_________________
Image
 
Top
Offline 
 
 
 [nl]
 Post subject: Re: Coding Help
PostPosted: Wed Jul 31, 2013 4:46 pm 
User avatar
Wreck 'n get stomped
Member
[*]
[*]
[*]
[*]
[*]

[*]
[*]
[*]
[*]
[*]

[*]
[*]
[*]
I have a problem with weird acting sprites in my game. When the player moves against the wall (you can't move him by pressing left and right btw, he moves automatically), and goes to the left, the sprite sort of 'flashes', I don't know how to explain. But normally, move_snap(1,1) would fix it, but now it doesn't for some reason. (To explain the problem better: it looks like his x just changes by 0.1 pixels to the right, so it 'flashes', the far right pixel gets small, big, small, big etc.) Here's some additional information:

Hspeed: 0.5
Room speed: 60
When it touches a wall, it changes direction and moves 1 pixel the opposite way.

Hope someone can help me out.

_________________
My Youtube | My Twitter
 
Top
Offline 
 User page at mfgg.net
 
 [us]
 Post subject: Re: Coding Help
PostPosted: Wed Jul 31, 2013 4:51 pm 
Member
[*]
[*]
[*]
[*]
[*]

[*]
[*]
[*]
[*]
[*]

[*]
[*]
I can almost guarantee that that is visible on some computers and not on others. Try moving the move_snap thing to end-step, or when drawing, round the place where the sprite is drawn. That might make it snappy-looking, though...

_________________
"talk about dang ol' this ain't scientific rockets, man"
Spoiler:
Bibby Team - Nice little place. Give it a try.
 
Top
Offline 
 User page at mfgg.net
 
 [nl]
 Post subject: Re: Coding Help
PostPosted: Wed Jul 31, 2013 4:58 pm 
User avatar
Wreck 'n get stomped
Member
[*]
[*]
[*]
[*]
[*]

[*]
[*]
[*]
[*]
[*]

[*]
[*]
[*]
Miles wrote:
I can almost guarantee that that is visible on some computers and not on others. Try moving the move_snap thing to end-step, or when drawing, round the place where the sprite is drawn. That might make it snappy-looking, though...

Ok, thanks. Moving it to end-step would let the player stop moving, though, because the hspeed is 0.5 (I used alarms), and the sprite isn't been drawed. Thanks for your help, though.

_________________
My Youtube | My Twitter
 
Top
Offline 
 User page at mfgg.net
 
 [jp]
 Post subject: Re: Coding Help
PostPosted: Fri Aug 02, 2013 4:08 pm 
User avatar
Yeah, I don't Even...
Member
[*]
[*]
[*]
[*]
[*]

[*]
WreckingGoomba wrote:
Miles wrote:
I can almost guarantee that that is visible on some computers and not on others. Try moving the move_snap thing to end-step, or when drawing, round the place where the sprite is drawn. That might make it snappy-looking, though...

Ok, thanks. Moving it to end-step would let the player stop moving, though, because the hspeed is 0.5 (I used alarms), and the sprite isn't been drawed. Thanks for your help, though.

well since a sprite can't be drawn on a half a pixel
you could do something simple like this in the draw step and you won't have those nasty half pixel graphic glitches:

draw_sprite_ext(sprite_index,image_index,floor(x),floor(y),image_xscale,image_yscale,image_angle,image_blend,image_alpha);

_________________
Spoiler:
 
Top
Offline 
 User page at mfgg.net
 
 [us]
 Post subject: Re: Coding Help
PostPosted: Fri Aug 02, 2013 4:58 pm 
Member
[*]
[*]
[*]
[*]
[*]

[*]
[*]
[*]
[*]
[*]

[*]
[*]
Shadow Kami wrote:
WreckingGoomba wrote:
Ok, thanks. Moving it to end-step would let the player stop moving, though, because the hspeed is 0.5 (I used alarms), and the sprite isn't been drawed. Thanks for your help, though.
well since a sprite can't be drawn on a half a pixel
you could do something simple like this in the draw step and you won't have those nasty half pixel graphic glitches:

draw_sprite_ext(sprite_index,image_index,floor(x),floor(y),image_xscale,image_yscale,image_angle,image_blend,image_alpha);
Exactly! Only problem is it may look snappy at some speeds (though probably not 0.5 so I reckon you're good with that).

_________________
"talk about dang ol' this ain't scientific rockets, man"
Spoiler:
Bibby Team - Nice little place. Give it a try.
 
Top
Offline 
 User page at mfgg.net
 
 [nl]
 Post subject: Re: Coding Help
PostPosted: Fri Aug 02, 2013 5:54 pm 
User avatar
Wreck 'n get stomped
Member
[*]
[*]
[*]
[*]
[*]

[*]
[*]
[*]
[*]
[*]

[*]
[*]
[*]
I already fixed it by changing the room speed. Thanks for helping, though.

_________________
My Youtube | My Twitter
 
Top
Offline 
 User page at mfgg.net
 
« Previous topic | Next topic »
Display posts from previous:  Sort by  
Go to page Previous  1, 2, 3, 4, 5, 6, 7, 8 ... 41  Next  [ 816 posts ]  Reply to topicPost new topic 


Who is online

Users browsing this topic: No registered users and 1 guest


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum
Jump to:  
cron
Powered by phpBB © 2000, 2002, 2005, 2007 phpBB Group