MFGG phpBB Message Boards Archive
https://phpbb.mfgg.net/

Coding Help
https://phpbb.mfgg.net/viewtopic.php?f=10&t=14053
Page 3 of 41

Author:  Im the Red Spy [ Wed May 15, 2013 7:58 pm ]
Post subject:  Re: Coding Help

I actually found an extension which serves its purpose. I thank you for your time though!

Perhaps you can help with something else though. I would like to have a sprite's angle set to the direction of which I am pointing the analog stick. For example, I hold the analog stick up, and i want the image to be at 90 degrees for that. Any ideas?

Author:  Miles [ Wed May 15, 2013 9:46 pm ]
Post subject:  Re: Coding Help

Which stick?
Left:
Code:
image_angle=point_direction(0,0,joystick_xpos(1)*10,joystick_ypos(1)*10);

Right (for Xbox 360 controllers):
Code:
image_angle=point_direction(0,0,joystick_upos(1)*10,joystick_rpos(1)*10);

Author:  Im the Red Spy [ Wed May 15, 2013 10:06 pm ]
Post subject:  Re: Coding Help

Thank you a lot! It works great!

Author:  Kirby's Adventure [ Sun May 26, 2013 5:46 pm ]
Post subject:  Re: Coding Help

I suppose this is a bump but how do you push an object (a block) in game maker?
I'll attach the .gmk to this post.

edit: aaand I can't add it as an attachment! Here's what I'm doing.

In the collision mario event for my 'pushblock' object, I have Check Object checking for Mario at x: 8 and y: 0. If so, it'll move his speed, which is Jump relative to position 3 or -3,0 respectively. I have no idea what i'm doing wrong. Mario just acts as if it's a it's solid, and thinks it's a sideways trampoline if it's not.

http://www.sendspace.com/file/liirlm

Author:  kremling [ Sun May 26, 2013 6:00 pm ]
Post subject:  Re: Coding Help

Put the .gmk on sendspace or some other hosting site and post the link. Drag and Drop is way harder to picture than code.

Author:  behind [ Mon May 27, 2013 1:51 pm ]
Post subject:  Re: Coding Help

Hey, guys, I'm having trouble with jump through platforms.

Here's a code for a normal nonsolid block (vertical floor collision) which for the most part works perfectly

Code:
platformID =  place_meeting(x,y+ymovementspeed,object0)
{if platformID and ymovementspeed > 0 //and y > platformID.y
 {var cc;
  cc = ymovementspeed + 1;
  while (!place_meeting(x,y+1,object0) and cc >= 0)      {y += 1;}
  onground = 1;
  jumping = 0;
  ymovementspeed = 0;
  repeat(round(random(2))+4)  {dust = instance_create(x+choose(-5,-4,-3,-2,-1,0,1,2,3,4,5),y+8,objDustCloud)};}}


and here's the one for a jumpthrough, which comes right after. Also nonsolid

Code:
//Jumpthrough platforms
platformID =  place_meeting(x,y+ymovementspeed,objBlockJumpThrough)
{if platformID == 1 and ymovementspeed > 0 and (!place_meeting(x,y,objBlockJumpThrough))
 {var cc;
  cc = ymovementspeed + 1;
  while ( (!place_meeting(x,y+1,objBlockJumpThrough) ) and cc >= 0)      {y += 1;}
  onground = 1;
  jumping = 0;

  ymovementspeed = 0;
  //if y > platformID.y {y = platformID.y;}
  repeat(round(random(2))+4)  {dust = instance_create(x+choose(-5,-4,-3,-2,-1,0,1,2,3,4,5),y+8,objDustCloud)};}}


pretty much the only thing different here is that I'm checking for an additional collision with the jumpthrough to see if the player is touching it in general rather than just y+vertical speed.
This code works okay, but the instant that the player comes into "general" contact with another jumpthrough, say one that's eye level to him while on another jumpthrough, he falls straight through the one he's currently walking on. I assume this is because I checked for the object and not the instance he is currently standing/walking on.

However, when I change !place_meeting(x,y,objBlockJumpThrough) to !place_meeting(x,y,platformID), the instance's ID, the player glitches up get's stuck in the platform while he's jumping and has presumably a positive vertical speed. This doesn't make any sense because the game is checking if he ISN'T generally intersecting with the platform, not if he IS.

Sorry, but changing any object's solidity is 100% out of the question because I need for all objects to always stay unsolid.

It's so frustrating. :/

Author:  Superbowser [ Tue May 28, 2013 2:32 pm ]
Post subject:  Re: Coding Help

@Wiiboy- Hmm... This is almost definitely a problem with checking the object instead of the instance. However, I can't seem to tell where the problem is at.
I'm guessing that this is for the same game that I attempted to help you debug before, but it wouldn't work on my computer. If you wanted, I could try it on my computer again and see if I can find a solution :D

Author:  behind [ Tue May 28, 2013 5:49 pm ]
Post subject:  Re: Coding Help

superbowser wrote:
@Wiiboy- Hmm... This is almost definitely a problem with checking the object instead of the instance. However, I can't seem to tell where the problem is at.
I'm guessing that this is for the same game that I attempted to help you debug before, but it wouldn't work on my computer. If you wanted, I could try it on my computer again and see if I can find a solution :D
It's actually for a different engine with a similar............intent if you will.

Compared to the previous game, it's very early in development and has no FMOD stuff so it should literally give you no error at all. I can PM you the gmk again.

Author:  Superbowser [ Tue May 28, 2013 8:16 pm ]
Post subject:  Re: Coding Help

Ok, you can send it over whenever you get the chance. :D

Author:  LuNiney [ Sun Jun 23, 2013 1:06 am ]
Post subject:  Re: Coding Help

Hi peepz, I have a question (sorry if this is a bump)

There has been a lot of time since anti-aliasing and scaling filters was discussed on Game Maker Community (Yoyogames)
and all said it was impossible... but that time Game Maker was on its 6th version, so I don't know if it can be possible now.

Basically, I wanna know if now with GM8 or Studio, is possible to create games with the filtering you see on various
emulators and even the Mario Forever fangame, the filters: Scale 2x, 2xSai, Super Eagle, Hq2x, etc.

EDIT:
For further reference, take these examples:
Normal image:
Image
Resized 3x:
Image
Hq3x filter:
Image

and a site:
http://www.hiend3d.com/hq3x.html

Author:  Shadow Kami [ Sun Jun 23, 2013 3:01 pm ]
Post subject:  Re: Coding Help

Nope, GMS nor it's previous incarnates naturally supporta that, so sorry.

Author:  Mr. Yoshbert [ Sun Jun 23, 2013 7:40 pm ]
Post subject:  Re: Coding Help

So I'm working on a textbox engine, similar to that of the Paper Mario games in which certain parts of text can have different colors and such. I already got the basic "letter-by-letter" typewriting thing down, so I thought about implementing a BB Code-style thing for the colors, but I'm absolutely lost on how to do it in GML.

Here's what I have so far:

Create:
Syntax: [ Download ] [ Hide ]
Using gml Syntax Highlighting
text_pos = 0;
text = "This is a [color=c_red]test[/color]."
text_spd = 2;

alarm[0] = 1;
 


Alarm 0:
Syntax: [ Download ] [ Hide ]
Using gml Syntax Highlighting
if ( text_pos <= string_length(text) )
{
     text_pos += 1;
     sound_play(snd_text_type);
     alarm[0] = text_spd;
}
 


Draw:
Syntax: [ Download ] [ Hide ]
Using gml Syntax Highlighting
draw_set_color(c_black);
draw_text(0, 0, string_copy(text, 1, text_pos));
 

Author:  kremling [ Sun Jun 23, 2013 8:01 pm ]
Post subject:  Re: Coding Help

I suppose you're asking how to go about reading the [color=c_red] (open tag) and making Game Maker understand that you want to switch the color based on the value that was placed after the equal sign?

Also, you can simply use the Step Event instead of an Alarm Event for this type of thing.

Author:  Mr. Yoshbert [ Sun Jun 23, 2013 8:07 pm ]
Post subject:  Re: Coding Help

kremling wrote:
I suppose you're asking how to go about reading the [color=c_red] (open tag) and making Game Maker understand that you want to switch the color based on the value that was placed after the equal sign?

Also, you can simply use the Step Event instead of an Alarm Event for this type of thing.

Yes, that's it.

Also, the reason why I'm using the Alarm Event is because a sound plays when a new letter appears. I'm assuming there's a better way, though.

Author:  Novak [ Tue Jun 25, 2013 8:22 am ]
Post subject:  Re: Coding Help

Hi, I'm making a Mario fangame with Game Maker 8.0, and I have a problem. Remember how in original Super Mario Bros. Goombas and Koopas walked in groups of 2 or 3? I decided to use that method for enemy movement in my game. Enemies move in groups and it's fine, but the problem is when they fall in pits. I want them to come back to their original positions when they fall in a pit. Since they are in groups, all 3 of them first have to fall in the pit and then come back. Can you people please help me solve the problem?

Author:  WreckingPrograms [ Tue Jun 25, 2013 8:34 am ]
Post subject:  Re: Coding Help

Novak wrote:
Hi, I'm making a Mario fangame with Game Maker 8.0, and I have a problem. Remember how in original Super Mario Bros. Goombas and Koopas walked in groups of 2 or 3? I decided to use that method for enemy movement in my game. Enemies move in groups and it's fine, but the problem is when they fall in pits. I want them to come back to their original positions when they fall in a pit. Since they are in groups, all 3 of them first have to fall in the pit and then come back. Can you people please help me solve the problem?

Let's say there's a group of 3 enemies.Then, in each enemy's code (enemies of that group only), put the following. EDIT: fixed some things, don't use the old code!

Syntax: [ Download ] [ Hide ]
Using gml Syntax Highlighting
//Step event
if y > room_height && canfall = true
{
canfall = false
global.mygroup -= 1
}

//Be sure this is in ONE of the group enemies' code only, else it will mess up
if global.mygroup = 0
{
//Regenerating code here
global.mygroup = 3 //NECESSARY!
}

//Create event
canfall = true
global.mygroup = 3


Hope this helped.

Author:  kremling [ Tue Jun 25, 2013 12:20 pm ]
Post subject:  Re: Coding Help

I don't think you can use a gloval variable for multiple if instances. Instead why don't you create a leader object. This leader object will create a number of instances to be involved in a group. You must keep track of the instance ids however because they will used check whether someone in the group is gone. I'll have to rewrite so it'll make more sense, but currently I am on my mobile device.

Author:  Novak [ Tue Jun 25, 2013 12:31 pm ]
Post subject:  Re: Coding Help

Thanks for solving my problem WreckingGoomba and kremling, now I know what to do.

Author:  WreckingPrograms [ Tue Jun 25, 2013 12:55 pm ]
Post subject:  Re: Coding Help

No problem, glad we could help ;)

Author:  kremling [ Tue Jun 25, 2013 1:50 pm ]
Post subject:  Re: Coding Help

@Yoshbert: Any luck on your text engine? I'll look into your problem today if you haven't alread found a solution.

Page 3 of 41 All times are UTC - 5 hours [ DST ]
Powered by phpBB © 2000, 2002, 2005, 2007 phpBB Group
http://www.phpbb.com/