ambiera logo

Ambiera Forum

Discussions, Help and Support.

folder icon Ambiera Forum > CopperCube > Help with CopperCube
forum topic indicator So I have this game and I need a system so that the gamewill randomly pick a track peice to put in front of the player
person icon
spicymilk
Registered User
Quote
2023-07-17 01:21:56

Think of the system like being from subway surfers Except I have 10 premade pieces and it just randomly lays it out

person icon
veganpete
Registered User
Quote
2023-07-17 07:56:22

First, import all your 10 track_obj pieces into the scene and set their position to 0,-1000,0 (to move them out of the way). Now place an empty node where you want the track-pieces to appear in the game (to make it easier).

Then use the following method to select a random track-piece and move it into the game...

Before First Draw (and on reload):
Set Variable: "Track" =0
//* (note that random integer needs to be set between "1 to 11" - so it will generate numbers between 1 and 10)

Every Few Seconds (2000ms), Set random value "Track" (Between 1 and 11),

Every Few Seconds (2000ms) If Variable "Track" =1,
Change Position of node: "Track1_obj" Relative to: "track_marker_node".

Every Few Seconds (2000ms) If Variable "Track" =2,
Change Position of node: "Track2_obj" Relative to: "track_marker_node".

Every Few Seconds (2000ms) If Variable "Track" =3,
Change Position of node: "Track3_obj" Relative to: "track_marker_node".

Every Few Seconds (2000ms) If Variable "Track" =4,
Change Position of node: "Track4_obj" Relative to: "track_marker_node".

Every Few Seconds (2000ms) If Variable "Track" =5,
Change Position of node: "Track5_obj" Relative to: "track_marker_node".

Every Few Seconds (2000ms) If Variable "Track" =6,
Change Position of node: "Track6_obj" Relative to: "track_marker_node".

Every Few Seconds (2000ms) If Variable "Track" =7,
Change Position of node: "Track7_obj" Relative to: "track_marker_node".

Every Few Seconds (2000ms) If Variable "Track" =8,
Change Position of node: "Track8_obj" Relative to: "track_marker_node".

Every Few Seconds (2000ms) If Variable "Track" =9,
Change Position of node: "Track9_obj" Relative to: "track_marker_node".

Every Few Seconds (2000ms) If Variable "Track" =10,
Change Position of node: "Track10_obj" Relative to: "track_marker_node".

*You can either use the same "Every Few Seconds" behaviour for all your actions, or you can use a separate "Every Few Seconds" behaviour for each action. Both methods will work, I chose separate behaviours in this example to make it easier to understand (and quicker for you to copy/paste if you try it).

What should happen is: every 2 seconds, the track will change randomly between your ten pieces... Depending on how you want your game to be, there are several methods you can then use, to move either the track/train/camera to make the train/track move along and make an endless-runner type game.


Create reply:










 

  

Possible Codes


Feature Code
Link [url] www.example.com [/url]
Bold [b]bold text[/b]
Image [img]http://www.example.com/image.jpg[/img]
Quote [quote]quoted text[/quote]
Code [code]source code[/code]

Emoticons


icon_holyicon_cryicon_devilicon_lookicon_grinicon_kissicon_monkeyicon_hmpf
icon_sadicon_happyicon_smileicon_uhicon_blink   






Copyright© Ambiera e.U. all rights reserved.
Contact | Imprint | Products | Privacy Policy | Terms and Conditions |