Author Topic: [Scripts] Minigolf Minigame in TM  (Read 389 times)

0 Members and 1 Guest are viewing this topic.

#

  • Member
  • ***
  • Posts: 158
  • I don't do much here.
  • Awards Month 1 members w/25+posts (4/21/13-5/12/13) 1 year on site
    • View Profile
    • Awards
  • Xbox: HellomeZodoz
[Scripts] Minigolf Minigame in TM
« on: January 27, 2018, 03:03:58 PM »
Hey guys, thought I'd show you my first small project since I've gotten total miner again. Since I haven't played since before variables got introduced, I decided I'd do something that could help me use a lot of different features. It's minigolf made of HUDs. Besides the 2 script blocks used to rotate the guide line, it only uses scripts to render the game. Anyway, here it is (Don't have to worry about horrible quality and a corny voiceover)!



The ball is controlled by aiming using the guide lines, and the power bar controlling the speed of the ball. The ball does have hit detection and some simple physics, so it will bounce off the walls correctly and it's speed will deteriote as it travels. As long as the ball is slow enough, it will go in the hole and you will win and it will tally up your strokes. I could add holes, but I thought this was a good enough demonstration :P. If you're wondering why it's cooped up in the corner instead of centered, it's because of the weird xy coordinate shift when using HUDs.

Anyways, it was pretty fun to do and I got to use the variables in some pretty cool ways. If you have any questions on how it works, or just any thoughts on it, please comment!

Thanks,
#

sora1kg

  • Jr. Member
  • **
  • Posts: 33
    • View Profile
    • Awards
  • Xbox: sora1kg
Re: Minigolf Minigame in TM
« Reply #1 on: January 27, 2018, 03:21:16 PM »
Heeeeeey!!!
Welcome back HelloMeZodoz!

omg this minigame's looks great!

Awesome!
« Last Edit: January 31, 2018, 09:50:21 PM by sora1kg »

Joel

  • Sr. Member
  • ****
  • Posts: 374
  • Awards 1 year on site
    • View Profile
    • Awards
Re: Minigolf Minigame in TM
« Reply #2 on: January 27, 2018, 10:04:37 PM »
COOL mini game how long did it take to make that

#

  • Member
  • ***
  • Posts: 158
  • I don't do much here.
  • Awards Month 1 members w/25+posts (4/21/13-5/12/13) 1 year on site
    • View Profile
    • Awards
  • Xbox: HellomeZodoz
Re: Minigolf Minigame in TM
« Reply #3 on: January 27, 2018, 10:54:11 PM »
COOL mini game how long did it take to make that

I'd say about 5 hours, but most of that was me messing around trying to see how the variables work :P

KryptoniteKS

  • Jr. Member
  • **
  • Posts: 12
    • View Profile
    • Awards
  • Steam: RelinquishedFire
Re: Minigolf Minigame in TM
« Reply #4 on: January 28, 2018, 01:03:54 AM »
Would you mind sharing the script or at least sharing how you got the physics to work with the ball on a HUD? I never gave thought to an idea like this.

Jaz

  • Supreme Member
  • *****
  • Posts: 2982
  • - Jaz
  • Awards Awarded to exemplary forum members 3 years on site Was in the top 10 of the forum stats page as of 4/12/15 Former MotM winners 4 years on site Donated a giveaway prize. (Must be a prize of cash value.) 2 years on site 1 year on site
    • View Profile
    • The Useless Web
    • Awards
  • Xbox: Jaz the MAN 2
  • PSN: Jaz_the_MAN_2
  • Steam: Jaz the MAN 2
Re: Minigolf Minigame in TM
« Reply #5 on: January 28, 2018, 06:47:45 AM »
Wow! This is very impressive, I've not seen anything like this in action before. Care to share the script? ;)



I had to break up with Medusa. I just got sick of buying mice for her hair.
I should have ended it sooner, but you try looking into those eyes.


#

  • Member
  • ***
  • Posts: 158
  • I don't do much here.
  • Awards Month 1 members w/25+posts (4/21/13-5/12/13) 1 year on site
    • View Profile
    • Awards
  • Xbox: HellomeZodoz
Re: Minigolf Minigame in TM
« Reply #6 on: January 28, 2018, 09:22:32 AM »

Would you mind sharing the script or at least sharing how you got the physics to work with the ball on a HUD? I never gave thought to an idea like this.

The ball is a 10x10 HudShape who's x and y coordinates are seperate variables, BPx and BPy (ball position x ball position y) HudShape [Ball] [player] [rect] [BPx, BPy, 10, 10]. It's movement is set up by checking where you're aiming, how much power use to move the ball and giving you a history mark depending on how much (1-100), and activating the corresponding script for that angle. Before any of the movement scripts activate however, a script will convert your power history into a seperate history called speed, which is the opposite value. So if you went full 100 power, it would give you 1 speed (this is very important later. Also, I know it's kinda confusing since speed should be higher as power is higher, but that's just the name I chose).

The movement scripts are set up so that depending on where your aiming, your ball will move x pixels left/right and y pixels up/down as long as your speed is below a 100. This is done by just adding x pixels to the BPx variable and y pixels to the BPy variable. It will also multiply your speed by a scaling factor (I think mine is something like 1.03?) and then loop the script by your speed variable. This basically means the lower the initial speed, the more times it will loop as well as how fast it loops allowing the ball to travel farther, faster. The longer it goes, the higher the speed so the longer it takes to loop. You then just check if they're gonna hit a wall by checking to see if the BPx and BPy coordinates are the same as the x and y coordinates of the wall. If it is, it will activate the script of its opposite direction.

For example if you wanted to aim to the right at a power of 100, it would first convert that power to a speed of 1. It would then active the aim 0 degree script. This will check to see if your speed is below 100. Since it just started, it's still at 1 so it's good to go. It will now add 10 pixels to the BPx variable and redraw the ball var [BPx] = [BPx] + [10]. It will also multiply the speed by 1.03 to become 1.03, var [speed] = [speed] * [1.03] and loop [speed]. It will then loop it again and the speed will increase again, and again, and again, all while the ball is moving 10 pixels to the right each time. Now, the speed variable is at 97. It will loop one more time and the speed will be greater than 100. It will now not move the ball and it will activate the aiming script for you to hit it again. To sink the ball into the hole, it just checks to see if your speed is above 90 and if your BPx and BPy are the same as the position of hole. The 45 degree angles are also the same except they just move the ball 7.071 pixels up/down and left/right.

Anyways, hope that explains it. I didn't feel like taking pics and this way i could try to explain what I'm doing, don't know if I did it well or not :P.