Jump to content


Photo

Need some help with my board game movement


  • Please log in to reply
10 replies to this topic

#1 _259514

_259514

    GMC Member

  • New Member
  • 4 posts

Posted 19 April 2012 - 10:21 PM

I found a old example of mario party style movement here on the forums. I am having trouble creating a way for the player to choice which path he goes on, then continue seemlessly on that path. Here is my GMK file for 8.0
http://www.mediafire...24ui2dust1uvy1y
I can get the player to follow a path just fine, however for each space i have to press the enter key once again, which i need to avoid somehow but am having trouble figuring out a way to do that.
  • 0

#2 ParodyKnaveBob

ParodyKnaveBob

    theUndiscovered

  • GMC Member
  • 992 posts
  • Version:GM:Studio

Posted 19 April 2012 - 10:38 PM

Howdy, _randombunchofnumbers, and welcome to the GMC, $:^ }

I don't usually do this, but because I'm short on time and have an experienced guess that it's a very common mistake, I'll try to answer without d/l'ing and examining your source. Are you perhaps checking for a Keyboard Press Event (or function) instead of just a Keyboard Event (or function)? The Press events (and functions) only return true when you've just pressed it since last step, whereas the normal checks (events and functions) simply return true when it's currently held down at that moment.

If I'm wrong, I'm sorry. Either way, regards,
  • 0

#3 _259514

_259514

    GMC Member

  • New Member
  • 4 posts

Posted 19 April 2012 - 10:45 PM

Howdy, _randombunchofnumbers, and welcome to the GMC, $:^ }

I don't usually do this, but because I'm short on time and have an experienced guess that it's a very common mistake, I'll try to answer without d/l'ing and examining your source. Are you perhaps checking for a Keyboard Press Event (or function) instead of just a Keyboard Event (or function)? The Press events (and functions) only return true when you've just pressed it since last step, whereas the normal checks (events and functions) simply return true when it's currently held down at that moment.

If I'm wrong, I'm sorry. Either way, regards,

Thanks for your reply but i think the problem is a bit deeper than that. Changing it to checking for a keyboard event will still create the problem of having to hold down the enter key during the dice roll movement. It also creates another problem with the code and make the player stay inbetween two spots while the enter key in continuously held down.
  • 0

#4 ookami125

ookami125

    GMC Member

  • GMC Member
  • 217 posts
  • Version:GM:Studio

Posted 19 April 2012 - 11:22 PM

I'm currently examining your source and i'll tell you what I get.
  • 0

#5 ookami125

ookami125

    GMC Member

  • GMC Member
  • 217 posts
  • Version:GM:Studio

Posted 19 April 2012 - 11:46 PM

basically what you have to do is make it so the arrows get deleted and don't get recreated until your'e not touching the "atjunction" object once the arrows are deleted you don't have to hit enter anymore you'll have to work out how to do this my head is really hurting right now but that's the basic idea of it if you still need help after a while just pm me i'll see what i can do then
  • 0

#6 _259514

_259514

    GMC Member

  • New Member
  • 4 posts

Posted 19 April 2012 - 11:55 PM

basically what you have to do is make it so the arrows get deleted and don't get recreated until your'e not touching the "atjunction"  object once the arrows are deleted you don't have to hit enter anymore you'll have to work out how to do this my head is really hurting right now but that's the basic idea of it if you still need help after a while just pm me i'll see what i can do then

Thanks for your help, ill give it a try.
  • 0

#7 ParodyKnaveBob

ParodyKnaveBob

    theUndiscovered

  • GMC Member
  • 992 posts
  • Version:GM:Studio

Posted 20 April 2012 - 12:11 AM

I apologize. I picked your post from the "Recently Added Topics" list and didn't realize this was in the Advanced Forum -- I'd been seeing a whole bunch of stuff in the Novice & Intermediate Forum, and I was still a bit attuned to all that. Sorry. Since I've already half-started any kind of suggestion, I feel a bit obligated to go further. I looked at your source.

I couldn't quite read your code style very well (mainly the inconsistent indenting), so I edited it a little:

// start moving
if focus!=noone // if you are at a spot
  if keyboard_check_pressed(vk_space) and !instance_exists(obj_Dice){ //roll the dice
    dice = instance_create(x,y-32,obj_Dice);
    with(dice)
      image_index = diceroll - 1;
  }

if instance_exists(obj_Dice) //getting ready to start moving
  if dice.diceroll != 0{
    if atjunction = 1{ //checks for a junction
      if keyboard_check_pressed(vk_enter){
        if firstarrow.selected = true and secondarrow.selected = false{
          if dice.diceroll != 0
            with(focus)
              other.goto = path[path_tot - 1];
        }else{
          with(focus)
            other.goto = path;
        }
      }
    }else{
      with(focus)
        other.goto = path;//[floor(random(path_tot))]; // select a random path from its list (will make a better menu for this)
      focus = noone;
    }
  }
  
if instance_exists(obj_Dice)
  if dice.diceroll = 0 {
    with(dice)
      instance_destroy();
  } // destroy dice image when player has moved all the spots
(That's still not a style I'm very accustomed to, but I'll try to roll with it.) Lemme read through this, "thinking aloud" and all that... I'll only examine the "getting ready to start moving" block since only it seems relevant...

If an instance of obj_Dice exists, then do all the following -- but if nonextant, completely skip:
  If the first dice instance''s diceroll variable is not 0, then do all the following -- but if 0, completely skip:

    If atjunction is 1, do Junction Code:
      If vk_enter has just been pressed, then do all the following Junction Code -- if it hasn''t, then skip:
        If the one variable is true and the other is false, then:
          Check *again* for the first instance of dice''s diceroll variable being 0 or not, which will always be true.
          With (focus) goal/noone, assign the obj_Player1''s goto variable to equal focus''s path[path_tot-1]''s value.
        else:
          With (focus) goal/noone, assign the obj_Player1''s goto variable to equal focus''s path[0] value.

    else (atjunction is not 1), do Non-Junction Code:
      With (focus) goal/noone, assign the obj_Player1''s goto variable to equal focus''s path[0] value.
      Assign noone to focus.
It would seem the only relevant portion really is the Junction Code. Simplified some:

If vk_enter has just been pressed, then do the following:

  If the one variable is true and the other is false, then:
    With (focus) goal/noone, assign the obj_Player1''s goto variable to equal focus''s path[path_tot-1]''s value.
  else:
    With (focus) goal/noone, assign the obj_Player1''s goto variable to equal focus''s path[0] value.
I didn't see in any of your objects any Keyboard Events (besides for the letter R), and the only vk_enter was in obj_Player1's Step Event's action 2. I haven't run the game because I don't have the Nearest-Nth-instance extension, and I haven't edited out the breaking function(s), but I don't see why this chunk of code wouldn't be fixable with keyboard_check(vk_enter) plus maybe one other variable (or function call) as a check for something else. That something else very well may be what you have to figure out. Otherwise, do you mind saying how/where etc. the Enter Key is even used anywhere to cause the side-effects you listed?

 
Okay, I changed this...
nextcloseststart = instance_nth_nearest(x,y,obj_Start,2);
to
other.firstarrow.closeststart.x += 5000;
nextcloseststart = instance_nearest(x,y,obj_Start);
other.firstarrow.closeststart.x -= 5000;
and got it running, plausibly without introducing error.

The problem I see while playing is that you go forward automatically until you hit that split path. Then, after that, from then on you continue to stop at each little goal thingy. Whether this has to do with arrows like ookami125 stated or something else, I haven't determined, but I am popping in and out to this between tasks at work, soooo... $F^ b I'll keep adding as I go...

 
You have code (like that path[] array) to set up where to go next, with your vk_enter conditional changing where you go when it's pressed. That could easily be what's reversing your direction upon hitting enter -- which inclines me to think ookami's totally right about those arrows...

Regards again,

Edited by ParodyKnaveBob, 20 April 2012 - 01:32 AM.

  • 0

#8 ookami125

ookami125

    GMC Member

  • GMC Member
  • 217 posts
  • Version:GM:Studio

Posted 20 April 2012 - 01:44 AM

yea i tested it a little bit i got it to work but then it went all screwy again
  • 0

#9 ookami125

ookami125

    GMC Member

  • GMC Member
  • 217 posts
  • Version:GM:Studio

Posted 20 April 2012 - 01:49 AM

found out what was going wrong
in obj_player1:
collision with obj_stopjunction
change
atjuntion = 0;
to
atjunction = 0;
then it will work lol can't believe it was something as simple as missing one letter and i missed it!
but i do suggest getting rid of the arrows after you leave

PS thanks for asking this it made me really happy and i laughed so hard but yea that's what happened
oh and the way i found out the problem Debug_mode watched the obj_player1's values and notice when he went over the obj_stopjunction a new value was created

Edited by ookami125, 20 April 2012 - 01:55 AM.

  • 0

#10 _259514

_259514

    GMC Member

  • New Member
  • 4 posts

Posted 20 April 2012 - 04:56 PM

I would like to thank you all for your help. It isnt working exactly the way i want it too still but i think I can take care of the rest.
  • 0

#11 Magik

Magik

    GMC Member

  • GMC Member
  • 95 posts

Posted 20 April 2012 - 06:11 PM

_25914 Here, found out my old accounts password.
I have gotten it to work completely. Once again I thank you guys for your help.
  • 0




0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users