﻿ Stars of the background
• April 20, 2021, 07:59:30 PM
• Welcome, Guest

News:

For WME related articles and tutorials visit WME Resource Center.

Pages: [1]

AuthorTopic: Stars of the background  (Read 2660 times)

0 Members and 1 Guest are viewing this topic.

HIman

• Lurker
• Karma: 0
• Offline
• Gender:
• Posts: 24
• Russian adventure !
Stars of the background
« on: November 21, 2005, 11:58:45 AM »

All greetings!
I try to make running up stars, from the center to edges of the screen.
Also there were some questions:
1. How to place sprite stars in a starting position after she has reached edge of the screen?
2. Why twitching moving of stars, though FPS = 100 is appreciable?

The script of a star is resulted below:
Code: [Select]
`#include "scripts\base.inc"//this script moves the stars of the background of the menu//start on centerself.X = 1024/2;self.Y = 768/2;//ramdom movement directionvar a = Random(0,359);var incX = sin(a);var incY = cos(a);while(true){ //move the sprite self.Y = self.Y + incY*4; self.X = self.X + incX*4; Sleep(20);}`
Can eat easier with the decision?
Logged

McCoy

• The cocido eater
• Frequent poster
• Karma: 0
• Offline
• Gender:
• Posts: 365
• Spurrrrrrring
Re: Stars of the background
« Reply #1 on: November 21, 2005, 07:51:29 PM »

Point 1 is easy:

Code: [Select]
`If (self.X > 1024 || self.X < 0 || self.Y > 768 || self.Y < 0){//start on centerself.X = 1024/2;self.Y = 768/2;//ramdom movement directionvar a = Random(0,359);var incX = sin(a);var incY = cos(a);}`

I don't know if that's how IFs with ORs were done in WME, I've not coded in quite long time. But you get the idea.
Logged

HIman

• Lurker
• Karma: 0
• Offline
• Gender:
• Posts: 24
• Russian adventure !
Re: Stars of the background
« Reply #2 on: November 21, 2005, 10:40:40 PM »

Well, it I also wanted to see thanks...
All works wonderfully.
Logged

Jerrot

• Global Moderator
• Addicted to WME forum
• Karma: 0
• Offline
• Gender:
• Posts: 690
Re: Stars of the background
« Reply #3 on: November 22, 2005, 11:15:35 AM »

Well, it I also wanted to see thanks...
All works wonderfully.

Did I miss something or shouldn't it be Math.sin() and Math.cos()?
Logged
Mooh!

HIman

• Lurker
• Karma: 0
• Offline
• Gender:
• Posts: 24
• Russian adventure !
Re: Stars of the background
« Reply #4 on: November 22, 2005, 11:55:31 AM »

Did I miss something or shouldn't it be Math.sin() and Math.cos()?
[/quote]

Certainly
Logged
Pages: [1]

Page created in 0.026 seconds with 20 queries.