iPhone App Directory
RPG Maker VX
 
Gallery Members Search Calendar Help


Welcome Guest ( Log In | Register )

Collapse

>Announcement

Keep an eye out for the upcoming 3rd Quarter Contest!

> ATTENTION!

Do not post questions about Ace in this section. Any and all Ace related support should be posted in the Ace section found here.

 
Closed TopicStart new topic
> Level help
Xios
post Apr 13 2012, 08:39 PM
Post #1



Group Icon


Type: Undisclosed




I set up a sort of carnival in my game. One of the attractions is a sort of archery contest: The player at the left, target at the right, obstacles between. I'm trying to set it up to have progressive levels.

Basically, I set it up like this:

At the leftmost side of the area, there's a bow. In front of that is an "arrow" event, with no graphic (so it can't be seen). Triggering the bow (action button) activates a switch that runs the 2nd page of the 'arrow' event, which renders it visible (custom arrow graphic) and sets its move route to Move Right 20 times, as the first level sets the target about that far away.

In addition, I wanted the "camera" to follow the arrow, so I set up a Scroll Map event to coincide with the arrow's activation. This took a while to get right as setting the arrow's route via the "autonomous movement" options or just with a singular Move Right set to repeat caused the scrolling to move faster than the arrow no matter what speed was set. (If not for that, I could manage this all easily...But since each individual move has to be accounted for, it gets tedious)

Anyway, the issue I'm having is progression. I want each successive "level" of this contest to place the target farther away, so I need the arrow to move farther. Is there some way I can have it tack on extra Move commands (about 20 per level) automatically with each level, instead of manually editing the event in every level (there's about 10-20)?
Go to the top of the page
 
+Quote Post
   
Pryde
post Apr 14 2012, 02:24 PM
Post #2


Chancellor of the Capellan Confederation.
Group Icon


Type: Writer
Alignment: Chaotic Neutral




It shouldn't be too hard to use variables, and just add the extra Move commands manually. Of course, your targets will need to be Events rather then Objects if you only want to see one target at a time. Don't forget to reset those variables back to zero when the player leaves or finishes the minigame if you want it to start from the beginning each time they play.


--------------------
OmniMech Bumper Sticker: Some Assembly Required
Go to the top of the page
 
+Quote Post
   
Onkei69
post Apr 14 2012, 04:16 PM
Post #3



Group Icon


Type: Undisclosed
Alignment: Chaotic Neutral




Yup, variables are the key.
I guess a compact way to achieve what you want is combining the use of variables and loops.

Here are my thoughts on the thing: (spoiler tags in case you want to try before looking at my solution)
Spoiler:
Mechanics: counting from 0 to the current level (or expected number of moves) and move the arrow for every count.
You need at least 2 variables: one for the current level, one for counting.

1. Set Var1 = expected number of moves
2. Set Var2 = 0 (initialization of the count)
3. Once you've set the arrow sprite, use a loop:
CODE
@> loop
-- @> Conditional branch: if Var2 < Var1
----- @> Set move: arrow, move right (check "Wait for Completion", else your arrow won't reach the expected position...)
----- @> Set Var2 += 1 (add 1 to Var2)
-- @> Else (meaning that Var2 = Var1 or Var2 > Var1, which is supposed not to be possible unless there's a bug)
----- @> Break loop
-- @> Branch end
  Repeat above

IMPORTANT NOTE: make sure you reset Var2 either at the end or the beginning of your event.

Now, if you want to follow your arrow, you can use the same system of conditional branch within a loop. However, you need to know from which position/number of moves you need to move the screen. Let's say you want your arrow to be in the center of the screen (y=6) with an initial position at y=2. It means that you need to move 4 tiles before moving the screen. Add the following event commands just before "@>Set Var2 += 1":
CODE
----- @> Conditional branch: if Var2 > 3 (in facts, when 0 = move number 1, so when 3 = move number 4)
-------- @> Scroll screen: 1 right (speed as you want)
----- @> Branch end

IMPORTANT NOTE: at the end of the screen scrolls, you have to scroll the screen back to the player (I know, what a pain...).
So when you want to scroll back, just use the same conditional branch system as above.
CODE
@> Set Var2 = 0
@> loop
-- @> Conditional branch: if Var2 < Var1
----- @> Conditional branch: if Var2 > 3
-------- @> Scroll screen : 1 left (adapt the scrolling speed to the arrow speed !)
----- @> Branch end
----- @> Set Var2 += 1
-- @> Else
----- @> Break loop
-- @> Branch end
  Repeat above


I guess this should be it. (I've just tested the code. It must be all okay)


This post has been edited by Onkei69: Apr 14 2012, 04:24 PM


--------------------
Projects I support:
Spoiler:



My project (dropped):


Spoiler:
Go to the top of the page
 
+Quote Post
   
Xios
post Apr 14 2012, 09:13 PM
Post #4



Group Icon


Type: Undisclosed




Thanks. I'll try that out later today when I've got some time set aside.
Go to the top of the page
 
+Quote Post
   

Closed TopicStart new topic
1 User(s) are reading this topic (1 Guests and 0 Anonymous Users)
0 Members:

 

Lo-Fi Version Time is now: 29th July 2014 - 05:58 PM

RPGMakerVX.net is an Privacy Policy, Legal.