n00b needs some help

Talk about making games.

Postby Novice » Wed Feb 01, 2006 11:46 pm

For falling rocks you should do the next:

1.Make an actor that will create the rocks, parent it to the view and put above the top left corner of the view.

2.On create actor RockCreator
Create Timer rand 1000-5000(adjust as you see fit)

3.On timer crate actor rock

4.On create actor rock
Code: Select all
x = round(rand(640))+view.x;//640 is your screen res.
yvelocity = rand(10);//if you want random rock speeds
yvelocity =10; //if you want constant rock speed


5.On draw actor rock
Code: Select all
if (y>view.y+view.height+20)DestoryActor ("Event Actor");


Hope this explains it. :wink:
Why do i always get stuck?
User avatar
Novice
 
Posts: 399
Joined: Mon Aug 29, 2005 10:54 am
Location: Relative
Score: 5 Give a positive score

Postby duracel92 » Thu Feb 02, 2006 12:22 am

3.On timer crate actor rock

4.On create actor rock
Code: Select all
x = round(rand(640))+view.x;//640 is your screen res.
yvelocity = rand(10);//if you want random rock speeds
yvelocity =10; //if you want constant rock speed


5.On draw actor rock


i dont understand 3, i get some of 4, i dont understand 5 either...
duracel92
 
Posts: 132
Joined: Sat Jan 21, 2006 10:45 pm
Location: UK
Score: 0 Give a positive score

Postby Novice » Thu Feb 02, 2006 12:50 am

3. Well, whenever the timer counts once create the actor rock.
RockCreator-->Timer(RockCreatingTimer)-->Create Actor ("Rock");

4.On create actor event (in the rock atributes Rock-->create actor-->script editor)you set the rock so that it apears on a random x position, wich is rounded by the round(); function because the rand function creates float numbers and you have to round them down (you cant have a decimal x value like x=77,3) and you get a random number betwen 0 and 640 presuming that 640 is your screen width, then you add the x value of the screen because when you move the screen left or right (i just rememberd i told you to parent it so that elimnates the +view.x part of the function but il explain just in case) the value is changed to ex. -100 but the rocks are still created beween 0-640, get it?So you add them up (0 to 640) +(-100)=-100 to 540.

5.with the fifth function you check on each drawing of the rock (rock-->draw actor-->script editor) if the rock has fallen down enoug so you cant see it no more and if it did it destroys it, i could have used the Out of vision function but then you wouldn't be able to create the rock above the screen (because it is eaven then out of vision).
Why do i always get stuck?
User avatar
Novice
 
Posts: 399
Joined: Mon Aug 29, 2005 10:54 am
Location: Relative
Score: 5 Give a positive score

Previous

Return to Game Development

Who is online

Users browsing this forum: No registered users and 1 guest