We're a community of 1.1M IT Pros here for help, advice, solutions, professional growth and fun. Join us!
1,080,642 Members — Technology Publication meets Social Media
Username:
Password:
Lost login information?
Start New Discussion Reply to this Discussion

XNA - My Pumpkin Toss Indie Game and Scripting movement.

Hello Everyone!

PumpkinToss_TestRun__600x341_05292012

A simple idea, like tossing some pumpkin in XNA can take some time and thought to complete. I originally started my Indie game engine "Temporal Wars" back in 2008 with the idea of creating a specific Real-Time-Strategy game. Now, in 2012, I decided to change gears and update the engine to allow for some simple and complex movement patterns, based on scripting calls.

The idea is to transform some XNA scene item, like a rotation action, scale action or movement action. With this in mind, I started creating some simple scripting calls which allows updating any scene item in the engine. After several hours of work, I came up with a couple of basic commands to move an object. But, the problem with these simple move commands was the fact they only allowed movement from point A to point B. What I needed was a more complex movement concept, where the movements would combine different operations, like the scaling with movement, while following some path. As I thought about this a little longer, I then came up with another idea, which was to allow different movement actions based on a paths edge! This would then allow an item to move on a mult-path connection, changing speeds and rotation, while on the same path! So, how did I accomplish this? Well... with some nifty collections, queues and stacks, all hidden by some simple scripting calls at the end.

PumpkinToss_TestRun_MovementOnPath_647x364_pic1

Once I got the code completed, I was able to test my new path movement idea! As you can see in picture-A, a path was created in the engine, which moves between waypoints 1 - 5. Each red line in between the waypoint pairs is called an 'Edge'. As some scene item moves along the path or edge, it reacts differently, depending on what actions are entered for that 'Edge'. The palm tree is slowly moving along this path, with the first edge doing a simple movement interpolation between the two waypoints.

PumpkinToss_TestRun_MovementOnPath_647x364_pic2

By the time the palm tree reaches the edge junction point, between waypoint 3 and 4, then scaling operation takes effect automatically, as shown in prior picture. By the time it reaches the end of the path, the palm tree is now scaled back to full size, and is doing a rotation. Any 'Edge' can have multiple scripting action request for some scene item!

PumpkinToss_TestRun_MovementOnPath_647x364_pic3

Once you set your edges with the required actions, it is just a matter of calling one 'Scripting' call, and away your scene items goes!! :)

Ben Scharbach
www.temporalwars.com

Attachments PumpkinToss_TestRun__600x341_05292012.jpg 133.11KB PumpkinToss_TestRun_MovementOnPath_647x364_pic3.jpg 193.66KB PumpkinToss_TestRun_MovementOnPath_647x364_pic1.jpg 180.28KB PumpkinToss_TestRun_MovementOnPath_647x364_pic2.jpg 183.51KB
1
Contributor
0
Replies
1
View
berben11
Newbie Poster
10 posts since Feb 2011
Reputation Points: 10
Solved Threads: 0
Skill Endorsements: 0

This article has been dead for over three months: Start a new discussion instead

Post: Markdown Syntax: Formatting Help
 
You
 
© 2013 DaniWeb® LLC
Page generated in 0.0659 seconds using 2.71MB