Submit Your Article


 
RPG Maker

Welcome Guest ( Log In | Register )


  Games Resources RPG Maker VX RPG Maker XP Scripts Tutorials Downloads

 
Reply to this topicStart new topic
> [GM][TAW]Top-Down Shooter
HeroOfHyla
post Jun 4 2009, 09:39 PM
Post #1


Twirling towards freedom
Group Icon

Group: +Gold Member
Posts: 2,791
Type: Scripter
RM Skill: Advanced




Top Down Shooter
Link to GM TAW Program: http://www.rpgrevolution.com/forums/index....showtopic=31232
http://www.mediafire.com/download.php?zmymm3rd2fm
This is a demo of a possible way to make a top-down shooter game. It's probably not the most efficient way to do it (especially from an ease-of-customization) standpoint, but it's a start!



Enemy sprite by Darkblade.

EDIT:
Talking with Darkblade, seems like some people have problems with firing while moving diagonally up-left and down-right. I think it might be a limit on how many keys can be pressed. However, certain keys seem to be better with each other than others. If you can't get it to work right, try using WASD instead of arrow keys.

To do so, replace scrHandleFacing with this:
CODE
{
    //Facing is handled separately from movement direction, because otherwise it would be impossible to face a wall you were standing next to!
    //This script checks for basically every possible button combination for the arrow keys
    charDirect = charDirect;
    if (keyboard_check(ord('S')) && !keyboard_check(ord('W')))
    {
        charDirect = 270;
    }
    if (keyboard_check(ord('W')) && !keyboard_check(ord('S')))
    {
        charDirect = 90
    }
    if (keyboard_check(ord('D')) && !keyboard_check(ord('A')))
    {
        charDirect = 0;
        if (keyboard_check(ord('S')) && !keyboard_check(ord('W')))
        {
            charDirect = 315;
        }
        if (keyboard_check(ord('W')) && !keyboard_check(ord('S')))
        {
            charDirect = 45
        }
    }
    if (keyboard_check(ord('A')) && !keyboard_check(ord('D')))
    {
            charDirect = 180;
        if (keyboard_check(ord('S')) && !keyboard_check(ord('W')))
        {
            charDirect = 225;
        }
        if (keyboard_check(ord('W')) && !keyboard_check(ord('S')))
        {
            charDirect = 135
        }
    }
    image_index = charDirect/45;
}


and replace scrMovement with this:
CODE
{
    //because the origin point of the sprite is based on a pixel and not an intersection, x-13 is one pixel to the left of the image, and x+12 is one to the right.
    //if it were an intersection, you'd use 13 for both
    if (keyboard_check(ord('W')))
    {
        if (!collision_rectangle(x-12,y-13,x+11,y-13,objBlock,0,1))
        {
            y -= 4;
        }
    }
    if (keyboard_check(ord('S')))
    {
        if (!collision_rectangle(x-12,y+12,x+11,y+12,objBlock,0,1))
        {
            y += 4;
        }
    }
    if (keyboard_check(ord('A')))
    {
        if (!collision_rectangle(x-13,y-12,x-13,y+11,objBlock,0,1))
        {
            x -= 4;
        }
    }
    if (keyboard_check(ord('D')))
    {
        if (!collision_rectangle(x+12,y-12,x+12,y+11,objBlock,0,1))
        {
            x += 4;
        }
    }
}


__________________________
Asexual - Arizonan - Atheist
I've got a gmail account and a yahoo mail account under this name, if you need to contact me.
You can find me on facebook too. facebook.com/heroofhyla . If you send me a friend request, tell me who you are so I don't get confused.

PlagueRPG SITE IS WORKING! (if you see "test page," hit ctrl+f5)
Latest update: New battle system demo, April 19, 2010

http://heroofhyla.deviantart.com/ ----- http://heroofhyla.livejournal.com/ ----- http://thatonecomic.smackjeeves.com
Go to the top of the page
 
+Quote Post
   

Reply to this topicStart new topic
1 User(s) are reading this topic (1 Guests and 0 Anonymous Users)
0 Members:

 

Lo-Fi Version Time is now: 24th May 2013 - 07:19 AM
RPG RPG Revolution is an Privacy Policy and Legal
eXTReMe Tracker