Hello Guest, please login or register.
Did you miss your activation email?
Login with username, password and session length.

Pages: [1]   Go Down

Author Topic: Resident Evil GM 7 Question Topic  (Read 1518 times)

0 Members and 1 Guest are viewing this topic.
Resident Evil GM 7 Question Topic
« on: May 06, 2009, 05:08:34 am »
  • *
  • Reputation: +12/-2
  • Offline Offline
  • Gender: Male
  • Posts: 4850
So, I was brainstorming on how to pull off a decent RE inventory in GM.

I was thinking along these lines:

8 slots
Each slot has an item based on a variable:
~ 1 = empty
~ 2 = handgunammo
~ 3 = knife
..and so on.

No, if you pick something up, I was going to have it so that it would check each slot in turn:
psuedo code here
Code: [Select]
if global.slot1 = 1
{ do this (probably with a break or whatever) }
else if whatever(do the same as slot1)

Then if none of the slots are empty(1) then you cannot pick up the object.
If a slot is available, say slot 3, and you pick up a atomic bomb, it would change the global.slot3 variable to 666.  Then with that if slot3 = 666, you'd see the icon and have the actions for it.

-----breathe-----

Now, you items that can have more then one, would I just have other global variables?

Like this:
psuedo code warning
Code: [Select]
if global.slot2 = 5
    {
        show the handgun icon at whatever x and y
        show the value of global.handgunammo at whatever x and y
     }
 if !global.slot2 = 5
    {
         do not show the handgun icon at slot 2 nor the remaining ammo
    }


Sorry if it seems jumbled, just trying to clear my head and hope that someone can see where this is going.
« Last Edit: May 07, 2009, 03:08:33 am by Theforeshadower »
Logged
  • Super Fan Gamers!
Re: Resident Evil GM Question Topic
« Reply #1 on: May 07, 2009, 03:08:17 am »
  • *
  • Reputation: +12/-2
  • Offline Offline
  • Gender: Male
  • Posts: 4850
Meh dumping questions here:

I want to play the gunshot sound everytime the image_index on Leon while shooting is 1.
No probelms there.  Works fine.
But if you exit out of firing and try it again, you have to wait for a full cycle of the firing animation before you can here the sound.

I have the value of Leon's image_index showing in the left corner.

It doesn't use whole numbers :/ wtf?
it is always adding like 0.00 > 0.20 > 0.50 > 0.80 then if nothing changes back to 0.00
I don't see where the issue is.

Here, I'll just post the shooting code:
Code: [Select]
//aiming and firing ----------------------------------------------------------------------
if keyboard_check(ord('X')) && movable = 0
{
    if currentweapon = 1
    {
        sprite_index = pyr_idlefire1;
        image_speed = .2;
        firing = 1;
    }
}

if keyboard_check_released(ord('X')) && keyboard_check(ord('Z'))&& firing = 1
{
    sprite_index = pyr_idleaim;
    image_speed = .30;
    firing = 0;
    image_index = 0;
}


if sprite_index = pyr_idlefire1 && image_index > 5
{
   image_index = 0;
}

if sprite_index = pyr_idlefire1 && image_index = 1
{
 sound_play(pistol_shot);
}


I got other shitz in a Z-pressed Event too:
Code: [Select]
   
    {
    image_index = 0;
        speed = 0;
        movable = 0;
        sprite_index = pyr_idleaim;
    }

Basicaly, I am trying to get the image_index to reset back to 0 so when it gets to 1 you can hear the gunshot.
Logged
  • Super Fan Gamers!
Re: Resident Evil GM 7 Question Topic
« Reply #2 on: May 08, 2009, 01:38:18 am »
  • *
  • Reputation: +12/-2
  • Offline Offline
  • Gender: Male
  • Posts: 4850
Nevermind the above question as I finally figured it out.

New Question:

Leon moves based on direction out of 360 degrees(well actually 120 since you turn by 3 degrees).
I have his angle based upon direction.
How do I create a sprite at the tip of his gun?
Is there something easier then having to find the x and y values of Leon for all 120 degrees and create the gunblast sprite at those points?
Logged
  • Super Fan Gamers!

Mamoruanime

@Mamoruanime
Re: Resident Evil GM 7 Question Topic
« Reply #3 on: May 08, 2009, 02:00:28 am »
  • ^Not actually me.
  • *
  • Reputation: +9/-0
  • Offline Offline
  • Gender: Male
  • Posts: 9786
Nevermind the above question as I finally figured it out.

New Question:

Leon moves based on direction out of 360 degrees(well actually 120 since you turn by 3 degrees).
I have his angle based upon direction.
How do I create a sprite at the tip of his gun?
Is there something easier then having to find the x and y values of Leon for all 120 degrees and create the gunblast sprite at those points?

You have to write a script that calculates that position based on his rotation. It's a pain in the ass for people like me, who suck at math.
Logged
Re: Resident Evil GM 7 Question Topic
« Reply #4 on: May 08, 2009, 02:07:32 am »
  • *
  • Reputation: +12/-2
  • Offline Offline
  • Gender: Male
  • Posts: 4850
Nevermind the above question as I finally figured it out.

New Question:

Leon moves based on direction out of 360 degrees(well actually 120 since you turn by 3 degrees).
I have his angle based upon direction.
How do I create a sprite at the tip of his gun?
Is there something easier then having to find the x and y values of Leon for all 120 degrees and create the gunblast sprite at those points?

You have to write a script that calculates that position based on his rotation. It's a pain in the ass for people like me, who suck at math.
Really? Godamnit...
*glad he took Pre-Calculus in highschool*
u_u

I hate having to do scripts like that.  Be back in 20 years when this gets finished
*leaves*
lol

EDIT:
Wait!!!  Couldn't I just cheat by making the gunblast animation the dimensions as Leon and put the sprite itself to the edge and have it's angle based upon Leon's angle?

Huh huh? How do you like them lazy apples lol
« Last Edit: May 08, 2009, 02:09:45 am by Theforeshadower »
Logged
  • Super Fan Gamers!
Re: Resident Evil GM 7 Question Topic
« Reply #5 on: May 08, 2009, 02:25:18 am »
  • *
  • Reputation: +12/-2
  • Offline Offline
  • Gender: Male
  • Posts: 4850
Yeah my way works great.

Thanks for trying to help, Mammy.  Means alot.
Logged
  • Super Fan Gamers!
Re: Resident Evil GM 7 Question Topic
« Reply #6 on: May 08, 2009, 03:13:17 am »
  • *
  • Reputation: +1/-0
  • Offline Offline
  • Gender: Male
  • Posts: 4588
You should look into it. The more weapons you add to the game the harder and uglier it gets. Simple math and a script can help in the long run ;).

btw, I have no !@#$% idea.
Logged
the a o d c
Re: Resident Evil GM 7 Question Topic
« Reply #7 on: May 08, 2009, 06:54:43 am »
  • *
  • Reputation: +9/-0
  • Offline Offline
  • Gender: Male
  • Posts: 3725
Nevermind the above question as I finally figured it out.

New Question:

Leon moves based on direction out of 360 degrees(well actually 120 since you turn by 3 degrees).
I have his angle based upon direction.
How do I create a sprite at the tip of his gun?
Is there something easier then having to find the x and y values of Leon for all 120 degrees and create the gunblast sprite at those points?

Your way of making an animated sprite might work, but you get a lot of sprites and much has to be loaded in memory. Especially when you've got multiple weapons. Calculating the position and the rotation isn't that hard.

If you've got the origin of Leon in the middle of his sprite. There are 2 more things needed. The angle of where Leon is facing and the distance from the origin to the point of blast animation.

Then it is just a simple use of the 'sin' and 'cos' functions to calculate the point. But as you want to calculate a point on the circle, you might be better of with the 'asin' and 'acos'. I will need to check this in my math book.

If I remember correct the formulas for points on a circle is:

Angle = cos ( x / radius )
Angle = sin ( y / radius )
Logged
Re: Resident Evil GM 7 Question Topic
« Reply #8 on: May 08, 2009, 07:03:46 am »
  • *
  • Reputation: +3/-0
  • Offline Offline
  • Gender: Male
  • Posts: 3371
of course if the sprite origin is not in the centre you'll need x and y offsets.
Logged
Quote from: Jason
Your community is a bunch of stuck up turds.
Re: Resident Evil GM 7 Question Topic
« Reply #9 on: May 08, 2009, 07:12:01 am »
  • *
  • Reputation: +9/-0
  • Offline Offline
  • Gender: Male
  • Posts: 3725
Jup, and you can rotate the blast animation the same way as Leon. The direction of the blast is the same as the direction of Leon.
Logged
Re: Resident Evil GM 7 Question Topic
« Reply #10 on: May 08, 2009, 08:31:51 am »
  • *
  • Reputation: +3/-0
  • Offline Offline
  • Gender: Male
  • Posts: 3371
Come to think of it, I think you can set origins outside of the sprite area. If that's the case, you could just set the origin of the blast as far from the centre as the gun length is. But that would be cheating, and probably get messy.
Logged
Quote from: Jason
Your community is a bunch of stuck up turds.
Re: Resident Evil GM 7 Question Topic
« Reply #11 on: May 08, 2009, 10:58:00 am »
  • *
  • Reputation: +9/-0
  • Offline Offline
  • Gender: Male
  • Posts: 3725
That is also a possibility, but it would be troublesome if you want to use the same blast animation for the different lengths of guns.
Logged
Re: Resident Evil GM 7 Question Topic
« Reply #12 on: May 08, 2009, 12:20:01 pm »
  • *
  • Reputation: +0/-0
  • Offline Offline
  • Posts: 2245
there was a function introduced in gm6 to calculate those lengths. has the word length in it, that's all i kno
Logged
Re: Resident Evil GM 7 Question Topic
« Reply #13 on: May 08, 2009, 03:44:09 pm »
  • 笑い男
  • *
  • Reputation: +9/-0
  • Offline Offline
  • Gender: Male
  • Posts: 2124
point_direction
point_distance
?
Logged

この世に悪があるとすれば、それは人の心だ
  • .hack//The World
Re: Resident Evil GM 7 Question Topic
« Reply #14 on: May 08, 2009, 04:39:30 pm »
  • *
  • Reputation: +12/-2
  • Offline Offline
  • Gender: Male
  • Posts: 4850
-.- I meant by doing it my way that I made ONE sprite that is like 6 frames long and just rotate it based upon Leon's direction. So one image becomes 120 in a way.
Logged
  • Super Fan Gamers!
Pages: [1]   Go Up

 


Contact Us | Legal | Advertise Here
2013 © ZFGC, All Rights Reserved



Page created in 0.148 seconds with 52 queries.