Official Fangame Help Topic


#201

Don’t double post.
Look in the recruiting forums, a list is there.


#202

HELP! I am making a metroid fangame and troid92 has posted some code for how the doors work, and when ever i use them, I go to the same position that i was in in the last room. the samus object is persistant (I have two samus objects, 1 for the sprites, and 1 for the masks, the sprite object is set to go to the mask’s coords each step), and the door instances have diffrent coords.

i did this:

but how do i put “x = global.startx;
y = global.starty;” in samus’s creation event? she already did that at the start of the game.


#203

HALP

  1. Wtf is solid. GM doesn’t explain exactly what it means anywhere. Does it just mean that collision detection is based on the entire object, not just the bounding box (or, you know what I mean)?

  2. How exactly does room_set_code(ind,str) work? I think it sets the creation code for a room, but it’s not as though I can put code inside the parentheses…


#204

Solid objects can’t pass through one another. It’s the main premise behind platforming. Any object the player can’t pass trough is solid. (ground, wall, closed door, etc.) You can use bounce functions in reaction to hitting a solid.

Collision detection is handled by the object mask (object sprite by default) typically.

  1. Yes you are correct, it sets the room creation code.
    And oh yes you can.
    e.g.
    All you do is write the code in string form ("start "end)
    Parentheses can go down as far as you like.
room_set_code(room3,[color=red]"global.exit_left_x=48
global.exit_left_y=128
if global.pirate_patrol=3 {
global.pirate_spawn_timer=200
}
global.music=bk_pirate_tension[color=red]" )

#205
  1. Uh, can’t I just do that by writing my own collision detection?
  2. Cool. <_<

#206

1)Yes, but it;'s for the GMNoobs.
2)Tis, innit.


#207

for my metroid fangame how do i make it so you can shoot then charge and also how do i make the little spark things fly out when charging
:confused:
Edit: i want to hold the shoot button after firing to charge a stronger bullet

Could anybody write it down in code for me?
Im using gamemaker (GML)

And could you also tell me wich script goes in what event? :smiley:


#208

Just check if you’re holding the button, and if you are, add 1 to a variable called charge, or something.
Just check to see if charge is larger than 1, and if so, send out particles/objects with a really small sprite depending on your pro/lite situation.
To hold shoot after firing, just check the variable you’re using to prevent shooting too fast.

I’d do it in code, but tbh I can’t remember, nor can be bothered to look, and you’ll learn an awful lot more from figuring it out from my slightly confusing explanation :stuck_out_tongue:

As for the events, any variable calling comes in create, and checking should probably be in step.

A lot of variable setting will be in whatever event you take the action, for example, the variable adding should be in the holding button event, and under release, you could reset it to zero, after checking if it’s over whatever, and if so creating a charge object.

Say if you don’t understand any of it, it’s silly to keep knowledge to onesself.


#209

For a super smash bros fangame how do you make it so your damage is shown at the bottom of the screen and the more damage you have the further you go flying when you get hit again :confused:

And can ya write it down in GML and also tell me what events each bit of code goes in and also what object (character or the symbol down the bottom of the screen) :smiley:


#210

So pretty much give you an engine you can copy and paste?
I can’t program worth a flip, but yeah.


#211

Dude, Zurg, that’s kind of the entire point of this topic.


#212

rofl.

I’m awful at actually writing people code, and don’t like doing it anyway.

SO:
firstly you need a global variable, global.damage1 or something, for your first character.
When they’re hit, add something to that (global.damage1+=attack strength)
Also when they’re hit, use whatever system you’re using to calculate how they fly, and multiply it by (damage/something) where something is a value you’ve come up with through trial and error, that feels good.

to draw it, just make a new object or something to draw global.damage1.

Then rewrite the code 4 times, so you has 4 peoples.

Is that ok?


#213

floats
so i have a morph ball that bounces

but once it is done bouncing
it stays one or two pixels above the gorund

if morph=true && vspeed>0 && place_meeting(x,y+4,object1){ &nbsp;if vspeed<1{ &nbsp; &nbsp; vspeed=0} &nbsp;else{ &nbsp; &nbsp; vspeed=-(vspeed/2)}}

thats the code for the bounce

floats


#214

I think for the if vspeed<1{ &nbsp; &nbsp;vspeed=0}you want to move it down to ground level as well. A for loop moving the sprite down until it’s touching the ground, for instance.


#215

like gravity?
i have gravity


#216

No, like a snap to the ground.


#217

youve lost me


#218

After you’ve stopped bouncing, force the morph ball to hit the ground.


#219

Try this:

if(morph == true && vspeed > 0 && place_meeting(x,y+4,object1)) { ?if(vspeed < 1 && vspeed != 0) ?{ ? ? vspeed = 0; ? ? while(!place_meeting(x+sprite_width/2,y+sprite_height,object1)) ? ? { ? ? ? ?y += 1; ? ? } ?} ?else if(vspeed >= 1) ?{ ? ? vspeed = -(vspeed/2); ?} }

Sorry, I’m a bit of a syntax and organization freak when it comes to code >.>. I can see quite a few circumstances that this might not work completely, but it’s basically what Timmeh is suggesting.

This assumes that object1 is the object the morphball rolls on top of (ground), and that there are no empty pixels below the morph ball in its sprite. Also, if this takes you too low, try putting a +1 after the sprite_height in the while clause.

I added some stuff to the inner if and else because as it was, the program would continually be setting vspeed to 0 while the morphball is still, which I think is kind of inefficient. :stuck_out_tongue: Sorry for reformatting everything, lol.


#220

._.

it does the exact same thing…

and yes object1 is the ground and there are no open pixels below the ball