Welcome, Guest. Please login or register.

Login with username, password and session length

 
Advanced search

1411423 Posts in 69363 Topics- by 58416 Members - Latest Member: JamesAGreen

April 18, 2024, 04:17:09 PM

Need hosting? Check out Digital Ocean
(more details in this thread)
TIGSource ForumsCommunityTownhallForum IssuesArchived subforums (read only)TutorialsFirst game, top-down, pac-man style, need help
Pages: [1]
Print
Author Topic: First game, top-down, pac-man style, need help  (Read 1346 times)
RyanWorlds
Level 0
*


View Profile WWW
« on: November 08, 2014, 11:00:43 PM »

Hey everyone, I'm gettin my teeth sunk into my first game and I've already hit a bump. As I said above, I wanna make a game that has a top-down, Pacman style control mechanic to it. The player controls a bunny and eats various items in the map. I had some basic controls where if you push up, he goes up. Push left, he goes left. Pretty much exactly like Pacman. Then I decided that I didn't like the feel of it so I wanted to make it a little more complicated than that.

FIRST) I want the bunny to hop. I don't want him to just glide. I want him to hop with every step.

SECOND) I want him to not just go left or right when those directions but rather I want him to turn and then go forward when up is pushed (kinda like the original Resident Evil games but without the confusing camera angles).

Obviously I will add to it after I get these down but those are my first baby steps that I want to take to start this project. Can anyone point me in the right direction for tutorials or help with the programming? Thank you all so much!
Logged
InfiniteStateMachine
Level 10
*****



View Profile
« Reply #1 on: November 09, 2014, 04:28:20 AM »

how are you currently developing the project? 
Logged

RyanWorlds
Level 0
*


View Profile WWW
« Reply #2 on: November 09, 2014, 11:34:48 AM »

I'm just using Adobe Flash CC. I drew out my sprite and converted it to a movie clip. Like I said, this is my first time trying to make a game so it's definitely safe to say that I don't really know what I'm doing haha I'm posting what I have so far below and please keep in mind that I have been playing around with the code a lot so it looks a little weird.

Code:
import flash.events.KeyboardEvent;
import flash.events.Event;
import flash.events.Event;

var rightKeyIsDown:Boolean = false;
var leftKeyIsDown:Boolean = false;
var upKeyIsDown:Boolean = false;
var downKeyIsDown:Boolean = false;

var turning:Number = 0;
var turningMax:Number = 8;

var step:Number = 0;
var fullStep:Number = 13;
var playerSpeed:Number = 26;


stage.addEventListener(KeyboardEvent.KEY_DOWN, pressAKey);
stage.addEventListener(KeyboardEvent.KEY_UP, releaseAKey);


// Move FORWARD and BACKWARD
function pressAKey(event:KeyboardEvent):void{
if(event.keyCode == Keyboard.UP){
upKeyIsDown = true;
}
if(event.keyCode == Keyboard.DOWN){
downKeyIsDown = true;
}
}

function releaseAKey(event:KeyboardEvent):void{
if(event.keyCode == Keyboard.UP)
{
upKeyIsDown = false;
step = 0;
}
if(event.keyCode == Keyboard.DOWN)
{
downKeyIsDown = false;
}
}


atomHop.addEventListener(Event.ENTER_FRAME, moveThePlayer);


function moveThePlayer(event:Event):void{
if(rightKeyIsDown == true){
atomHop.x += playerSpeed;
}
if(leftKeyIsDown == true){
atomHop.x -= playerSpeed;
}
if(upKeyIsDown == true){
step += fullStep;
if (step > playerSpeed){
upKeyIsDown = false;
step = 0;
}
atomHop.y -= step;
}
if(downKeyIsDown == true){
atomHop.y += playerSpeed;
}
}
Logged
Pages: [1]
Print
Jump to:  

Theme orange-lt created by panic